Python

时间:2014-06-27 20:17:22   收藏:0   阅读:193

1、类、子类与函数定义: 

class Animal(object): # object 继承object类。
    Paw=True
    Age=1
    def Eat(self,a):
        print(a)

class Tiger(Animal): # object 继承Animal类。
Address="Forest"

 2、初始化函数_init_

class User(object):
    Name="aa"
    def __init__(self):
        self.Name="b"

 

Python,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!