O'Reilly logo

C++ Multithreading Cookbook by Milos Ljumovic

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Explaining inheritance, overloading, and overriding

Inheritance is a very important characteristic of OOP. It is the relation between two (or more) classes: if class B is some kind of class A, then the objects of class B have the same properties as the objects of class A. In addition to that, class B can implement new methods and properties, and thus supersede the base class A.

Getting ready

Make sure Visual Studio is up and running.

How to do it...

Let's review this example by performing the following steps:

  1. Create a new default console application. Name it InheritanceTest.
  2. Open the InheritanceTest.cpp file and insert the following code:
    #include "stdafx.h" #include <iostream> using namespace std; class CPerson { public: CPerson(int iAge, char* sName) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required