Class declaration
From cppreference.com
Contents |
Syntax
Template:cpp Template:sparam { Template:sparam } Template:sparam ;
|
(1) | ||||||||
Template:cpp Template:sparam : Template:sparam { Template:sparam } Template:sparam ;
|
(2) | ||||||||
Template:cpp Template:sparam ;
|
(3) | ||||||||
Template:cpp Template:sparam Template:cpp Template:sparam | (4) | (since C++11) | |||||||
Class Body
A list of member and friend declarations and access specifiers:
Template:cpp | (1) | ||||||||
Template:cpp | (2) | ||||||||
Template:cpp | (3) | ||||||||
Template:cpp Template:sparam | (4) | ||||||||
Template:sparam | (5) | ||||||||
Template:cpp Template:sparam | (6) | ||||||||
Template:sparam | (7) | ||||||||
Ancestor List
A list of classes that have already bee fully defined optionally prefixed with an access pecifier
Object List
An optional list of instances of the previously defined class
Explanation
- Defines a class and its member
- Defines a class inheriting other classes
- Forwards declares a class
- Defines a class that cannot be derived from ( see final )
If friend or member functions have their body defined inside the class body, they are implicitly inlined
Notes
(since C++11) A default value can be assigned to data members inside the class body (ie: not necessarily in a constructor)
See also