睡過頭好厲害啊!XD
latest #10
Object:An object is characterized by a number of operations and a state which remembers the effect of these operations.
Class:A class represents a template for several objects and describes how these objects are structured internally.
Objects of the same class have the same definition both for their operations and for their information structures.
立即下載
Instance:An instanceis an object created from a class. The class describes the (behavior and information)structure of the instance,operations performed on the instance.
while the current state of the instance is defined by the
operations performed on the instance
資料成員(data members)和屬性(attributes)是同義詞,都是用來儲存物件的狀態。如果一個class沒有任何資料成員,這個class所產生的所有objects看起來就會是一模一樣的東西。也就是說,可以把一個沒有狀態的class變成一個static class,不用產生任何instance就可以呼叫該class的operations。
jdoe
7 years ago
(dice20)
jdoe
7 years ago
(dice)
jdoe 分享
7 years ago
back to top