Course Object Oriented Programming

Inheritance in C++ (protected)

Course's Page 10 min Text by
User Image
Abacate

In this lesson, you will learn the latest type of visibility that can be used in C++ inheritance: the protected.

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 : protected person {
    // derived class code    
};