python类的继承的两种方式
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() /**结果**/ Name: kity Animal is running... kity