Python面向对象
来源:互联网 发布:移动硬盘恢复软件 编辑:程序博客网 时间:2024/06/06 05:29
定义一个类
class 类名
class HelloWorld
定义类的构造方法
def init(self)
def __init__(self,name,age): self.name=name self.age=age print("my name is {0} age is {1}".format(name,age));h=HelloWorld("郭金龙",22)
继承一个类
class Hi(HelloWorld): def __init__(self, name): HelloWorld.__init__(self,name,22)//引用该类的父类的构造方法 def sayHi(self): print("say my name---{0}".format(self.name))h=HelloWorld("郭金龙",22)h1=Hi("郭金龙")h1.sayHi()
0 0
- python 面向对象
- python面向对象初步
- python面向对象
- Python面向对象详解
- python面向对象编程
- python面向对象
- python 面向对象
- python 面向对象编程
- python面向对象编程
- python面向对象编程
- python 面向对象笔记
- Python 面向对象编程
- Python面向对象编程
- python面向对象1
- Python面向对象详解
- Python 面向对象编程
- python面向对象1
- Python面向对象基础
- 布局别名 屏幕方向限定符
- 静态链接库和动态链接库的区别
- c++_2: 类的定义
- 计算机技术领域当前的主流技术及其社会需求调查报告
- An Implementation of Double-Array Trie
- Python面向对象
- 锐浪报表+条件查询
- Hibernate框架学习(三) 关系映射
- lzma sdk文件压缩与解压
- 字符编码笔记:ASCII,Unicode和UTF-8
- MVP 模式在 Android 中的使用
- (开发利器);全部springmvcm HTML5 bootstrap 全新技术
- H5/CSS3/JS/DOM最全大全网
- C-053.static与extern对函数的作用