class Animal(object): """docstring for Animal""" def __init__(self, name): self.name = name def run(self): print ('Animal is running...',self.name)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()
来源:https://www.cnblogs.com/bobo200/p/11457396.html