面向对象编程
类class
class Orange:
def __init__(self,w,c):
self.weight = w
self.color = c
print("Created!")
orl = Orange(10,"dark orange")
print(orl.color)
print(orl.weight)
class Orange:
def __init__(self,w,c):
self.weight = w
self.color = c
print("Created!")
orl = Orange(10,"dark orange")
orl = Orange(8,"light orange")
orl = Orange(6,"yellow orange")
>>>
Created!
Created!
Created!
橘子也会烂掉
cl