标签:ar art on c ef python as r return
class Pet: __name = "" def __init__(self, name): self.__name = name def bark(self): return "Pet : " + self.__name def getName(self): return self.__name; class Dog(Pet): __age = -1 def __init__(self, name, age): Pet.__init__(self, name) self.__age = age def bark(self): tmp = Pet.bark(self) return tmp + "\nDog : " + self.getName() + ", age:" + str(self.__age) if __name__ == '__main__': d = Dog("martin", 30) print(d.bark())
标签:ar art on c ef python as r return
原文地址:http://blog.csdn.net/miscclp/article/details/39001231