Using secure inheritance

In preparation for the exam, I am looking at the old exam, and there is one question that I simply cannot find the answer to. I do not have the correct solution to the answer, and my teacher was an MIA for a while. The question is not originally in English.

Suppose a CI class inherits from a Sup class like: class CI : protected Sup { . Why is this not a classifying inheritance?

+4
source share
1 answer

Why is this not a classifying inheritance?

In general, inheritance provides a natural classification mechanism for types of objects, allowing you to uniquely model the community of objects. When class D inherits class B public, the relationship between classes becomes

 D is a B 

This establishes the classification: "all D are B s".

However, when the inheritance is private or protected, D does not become B , so it is not possible to establish an additional classification over D In fact, private or protected inheritance can be seen as an implementation detail, not an interface detail.

+4
source

All Articles