#coding=utf8
class Cup:
#构造函数,初始化属性值
def __init__(self,capacity,color):
self.capacity=capacity
self.color=color
def retain_water(self):
print("杯子颜色:"+self.color+",杯子容量:"+self.capacity+",正在装水.")
def keep_warm(self):
print("杯子颜色:"+self.color+",杯子容量:"+self.capacity+",正在保温.")
class Luminous_Cup(Cup):
#构造函数,调用父类的构造函数初始化属性值
def __init__(self,capacity,color):
super().__init__(capacity,color)
def glow(self):
print("我正在发光...")
currentCup=Luminous_Cup('300ml','翠绿色')
currentCup.retain_water()
currentCup.glow()