#-*- coding:utf-8 -*-
class Animal(object):
"""docstring for Animal"""
def __init__(self, name):
self.name = name
def run(self):
print 'Animal is running...'
class Dog(Animal):
"""docstring for Dog"""
def __init__(self,name):
# super(Dog, self).__init__(name)
Animal.__init__(self,name)
def printName(self):
print 'Name: %s' % self.name
kk=Dog("kity")
kk.printName()
kk.run()
python类的继承的两种方式
最新推荐文章于 2024-07-08 17:55:59 发布