摘要: 1 # 需要提前导入 abc模块 2 import abc #abstract class 3 class Animal(metaclass=abc.ABCMeta): 4 @abc.abstractmethod 5 def eat(self): 6 pass 7 8 @abc.abstractme 阅读全文
posted @ 2018-04-16 16:16 yangweiwe 阅读(128) 评论(0) 推荐(0)
摘要: 1 class PeopleBMI: 2 def __init__(self,name,weight,height): 3 self.__name=name #把name属性隐藏起来。 4 self.weight=weight 5 self.height=height 6 @property 7 d 阅读全文
posted @ 2018-04-16 15:39 yangweiwe 阅读(245) 评论(0) 推荐(0)