# encoding: utf-8
class Animal(object):
"""docstring for Animal"""
def __init__(self, name, age):
super(Animal, self).__init__()
print 'animal __init__'
self.name = name
self.age = age
def move(self):
print 'animal move'
class Cat(Animal):
def __init__(self, name, age):
super(Animal, self).__init__()
print 'cat __init__'
def move(self):
super(Cat, self).move() # 调用父类方法
print 'cat move'
a = Animal('nn', 4)
a.move()
c = Cat('c', 5)
c.move()
3069

被折叠的 条评论
为什么被折叠?



