C++ Inheritance
Access specifiers and Inheritance.
C++ Access Specifiers & Inheritance
In C++, there are three access specifiers:
public- members are accessible from outside the classprivate- members cannot be accessed (or viewed) from outside the classprotected- members cannot be accessed from outside the class, however, they can be accessed in inherited classes.
Inheritance
It is possible to inherit attributes and methods from one class to another. We group the "inheritance concept" into two categories:
- derived class (child) - the class that inherits from another class
- base class (parent) - the class being inherited from
To inherit from a class, use the : symbol.