Feb 5, 2011 at 1:20am UTC
is it possible to inherit private elements of the base class.
I mean inheriting the private elements, (not private inheritance, were base class elements become private in the inheriting class)
Feb 5, 2011 at 1:37am UTC
The answer to what I think you're asking is "no". The whole point of 'private' is that nothing else can access it.
If you want something your children can have access to, make it 'protected' instead.
(Although technically you do inherit private elements, you just can't access them)
Feb 5, 2011 at 1:41am UTC
it turns out with inheritance, everything is inherited apart from constructors
Feb 5, 2011 at 1:42am UTC
private elements can be accessed from the inheriting class. you need to use a function though
Feb 5, 2011 at 1:47am UTC
Yeah I think I misunderstood your question.
You're right. Everything is inherited except for ctors, dtors, and I think the assignment operator.
Although children cannot access private elements. Using a function just sidesteps that because then the children aren't accessing the members directly, the function is.