Overview of Classes

Class types are defined using the class, struct, and union keywords. For simplicity, types defined with these keywords are called class declarations, except in discussions of language elements that behave differently depending on which keyword is used.

Names of classes defined within another class (“nested”) have class scope of the enclosing class.

Syntax

class-name:

identifier

The variables and functions of a class are called members. When defining a class, it is common practice to supply the following members (although all are optional):