- C++ classes correspond to categories, and C++ class
objects correspond to individuals.
- You can view data types as built-in classes, and you can view
classes as user-defined data types.
- Class definitions generally include member variables, also
known as slots or fields.
- If you want to define a simple class, with member variables only,
then instantiate the following pattern, in which the member variable
declarations consist of a data type, followed by one or
more comma-separated member variable names, followed by a semicolon:
class class name {
public:
member variable declaration 1
...
member variable declaration n
};
- If you wish to use a class object's member-variable value,
then instantiate the following pattern:
class object's name.member-variable name
- If you wish to assign a class object's member-variable value,
then instantiate the following pattern:
class object's name.member-variable name = expression;
- C++ allows you to overload functions; C++ selects the
right function, from among those with identical names, by
matching argument classes and data types with parameter
classes and data types.