Python面向对象编程-创建一个类
class Dog: attr_01 = '毛发' attr_02='尖牙' def __init__(self,name): self.name=name def eat(self): print('爱吃肉骨头') def info(self,i): print('i') print(self.name) print(self.attr_01) print(self.attr_02)
class Dog: attr_01 = '毛发' attr_02='尖牙' def __init__(self,name): self.name=name def eat(self): print('爱吃肉骨头') def info(self,i): print('i') print(self.name) print(self.attr_01) print(self.attr_02)