使用super()繼承 分類: python 小練習 ...

__metaclass__=type #定義使用新式類 class Bird:     def __init__(self):         self.hungry = True #父類中的屬性hungry     def eat(self):         if self.hungry:             print 'Ha...Ha'             self.hungry=
相關文章
相關標籤/搜索