The Access Control of Our Inheritance
The next thing that we need to take a look at is access control and inheritance.
A derived class is able to access all of the parts of the base class that are not private at the time.
This means that the base class means that the members of the base class that should not be accessible to all of the member functions of the derived classes are going to be declared as private for the base class when we are doing this as well.
You will notice as we go through this that the derived class is going to be able to inherit all of the base class methods.
There are going to be a few different exceptions that we are able to use with this one based on what results we are hoping to get. Some of the exceptions that we need to remember include:
- The friend functions that are found with our base class.
- The overloaded operators that are there with our base class.
- The destructors, the constructors, and any of the copy constructors that are going to happen with our base class.
We need to make sure that we pay special attention to some of the different parts that show up with our access control.
If there are some restrictions that are found in our base class, then this is going to step in and cause some issues with the inheritance that we are working with as well.
And the child or the derived class is going to notice this along the way.