A class defines the abstract characteristics of a thing (object), including its characteristics and what it can do.
From a programming point of view a class can be described as a template from which direct instances are generated.
When a class is declared, the declaration includes its members, which describe its characteristics. Members of a class can be categorised as follows:
data member | constant | constant value associated with the class |
field | variable of the class | |
function member * | method | implements the computations and actions that can be performed by the class |
property | named characteristic associated with reading and writing that characteristic. | |
event | notification that can be generated by the class | |
constructor | implements actions required to initialise instances of the class | |
destructor | implements actions to be performed before instances of the class are permanently discarded | |
nested type | type that is local to the class |
* | Members that can contain executable code are collectively known as the function members of the class. |
From the perspective of users of classes in some programming languages, such as C++, properties can be used in the same way as data members, and data members and properties can be grouped into a single properties category, so that members are categorised simply as properties, methods and events as follows:
property | constant |
field | |
property | |
method | method |
constructor | |
destructor | |
event | event |
example | Java |
home | Home Page |