Skip to main content

Posts

Showing posts from 2018

OOP in C++

  C++ programming   Inheritance Refresher   New classes can be derived from existing classes using a mechanism called "inheritance".  Classes that are derived FROM are called "base classes" and derived classes are also known as sub-classes.  The following is an example: Inheritance   class Vehicle {      private:                 string Make;        string Color;        ... };  class Car: Vehicle {       // member list includes Make and Color      // other Car specific members would go here. }; In this example, Vehicle is the base class and Car is the derived class.   The car automatically inherits the Make and Color properties and is also free to implement its own properties and methods that are specific for a Car. ...