Simultaneous private and public inheritance in C++
Posted
by
gspr
on Stack Overflow
See other posts from Stack Overflow
or by gspr
Published on 2010-12-28T13:17:30Z
Indexed on
2010/12/28
22:54 UTC
Read the original article
Hit count: 239
c++
|inheritance
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?
© Stack Overflow or respective owner