August 2012
Intermediate to advanced
976 pages
30h 17m
English
In §7.2 (p. 268) we saw that classes defined with the struct and class keywords have different default access specifiers. Similarly, the default derivation specifier depends on which keyword is used to define a derived class. By default, a derived class defined with the class keyword has private inheritance; a derived class defined with struct has public inheritance:
class Base { /* ... */ };struct D1 : Base { /* ... */ }; // public inheritance by defaultclass D2 : Base { /* ... */ }; // private inheritance by default
It is a common misconception to think that there are deeper differences between classes defined using the struct keyword and those defined using class. The only differences are the ...
Read now
Unlock full access