Course Object Oriented Programming

Inheritance in C++ (private)

Course's Page 11 min Text by
User Image
Abacate

In this lesson, you will learn how to use private access in C++ inheritance.

Syntax

The basic syntax is shown below:

class <derived_class> : [<access>] <base_class> {
    // derived class code
};

For example:

Now letโ€™s take a look in how this syntax is used inside an example.

class student : private person {
    // derived class code
};