March 2018
Intermediate to advanced
183 pages
2h 34m
English
Inheritance allows a class to acquire the members of another class. In the following example, Square inherits from Rectangle. This is specified after the class name by using a colon followed by the public keyword and the name of the class to inherit from. Rectangle then becomes a base class of Square, which in turn becomes a derived class of Rectangle. In addition to its own members, Square gains all accessible members in Rectangle, except for its constructors and destructor.