Python類 靜態成員

Python類中的成員不用先行定義,以下例所示:python class a(): count = 0 這裏面的count是一個static變量,在Python中這被稱爲類屬性,假設咱們這樣執行:code class a(): count = 0 def __init__(self): count++; a1 = a() a2 = a() print a1
相關文章
相關標籤/搜索