Re:从非零开始的Python世界生活[9-类]

'''
mydog = Dog('willie',6)
print("My dog's name is " + mydog.name.title() + ".")
mydog.sit()
mydog.roll_over()
'''
#my_new_car = Car('audi','a4',2016)
#print(my_new_car.get_describe_name())
'''
self is a must in each func, but no need in use
'''

'''
my_new_car.update_odometer(23)
my_new_car.get_odometer()
#attention the modify is forever for one object
my_new_car.increment_odometer(13)
my_new_car.get_odometer()
'''
'''
my_tesla_another = ElectricCar('tesla','model s',2020)
print(my_tesla_another.get_describe_name())
my_tesla_another.battery.battery_size = 101
my_tesla_another.battery.describe_battery()
'''
#the modify for self.value is forever
import Re_9
#this call modulename.classname to call
my_new_car = Re_9.Car('byd','c4',2007)
print(my_new_car.get_describe_name())

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注


皖ICP备2021003932号
召唤伊斯特瓦尔