January 2019
Intermediate to advanced
458 pages
10h 35m
English
In addition to allowing you to organize code into objects, classes also allow for classes to serve as a template for other classes through the use of polymorphism. In C++, we can combine the properties of any number of classes into a new class, giving it custom properties and methods as well.
This is a very effective way to create user-defined types (UDTs), especially when combined with operator overloading to use common operators to define operations for addition, subtraction, and so on for the UDT.
Inheritance in C++ follows the following pattern:
class B : public A { // Private members. public: // Additional public members. };
Here, we declare a class, B, which derives from class A. This allows us to use any public methods ...