class Car(object):
def __init__(self,type,fee):
self.type=type
self.fee=fee
# 根据天数来算费用
def count(self,day):
self.day=day
print('{}租{}天一共花费{}钱'.format(self.type,day,day*self.fee))
p1=Car('奔驰',1000)
p1.count(3)
汽车租赁系统,构造函数,python面向对象
最新推荐文章于 2024-08-04 13:55:04 发布