Simultaneous private and public inheritance in C++
- by gspr
Suppose a class Y publicly inherits a class X. Is it possible for a class Z to privately inherit Y while publicly inheriting X?
To make this clearer, suppose X defines public methods x1 and x2. Y inherits X, overrides x1 and provides a method y. Does C++ allow for a third class Z to subclass Y in such a way that Y's implementation of x1 and y are privately available to it, while the outside world only sees it inheriting X publicly, i.e. having only a single public method x2?