Python: 學習系列之五:類、繼承、多態、封裝

類 class A(object): # 類屬性 name = 'cong' # 類方法 @classmethod def cm(cls, p1): print(p1) # 構造函數 def __init__(self, n): # 定義實例對象屬性並賦值 self.age = 20
相關文章
相關標籤/搜索