“”"
@theme 类
@time 2018/12/7
@author lz
@content 初始方法,同时设置初始值
“”"
class Cat:
def init(self,new_name):
print(1)
#self.属性名=属性的值
self.name=new_name
def eat(self):
print(2)
tom=Cat(“Tom”)
print(tom.name)
lazy_cat=Cat(“大懒猫”)
lazy_cat.eat()