1.1定义类
定义一个类,格式如下:
class类名:
方法列表
demo:定义一个Car 类
#定义类
classCar:
#方法
def getCarInfo (self):
print('车轮子个数:%d,颜色%s'%(self.wheelNum, self.color))
def move (self):
print ("车正在移动...")
1.1定义类
定义一个类,格式如下:
class类名:
方法列表
demo:定义一个Car 类
#定义类
classCar:
#方法
def getCarInfo (self):
print('车轮子个数:%d,颜色%s'%(self.wheelNum, self.color))
def move (self):
print ("车正在移动...")
本文标题:面向对象1 -11.10 欠缺
本文链接:https://www.haomeiwen.com/subject/gyeimxtx.html
网友评论