Possible Duplicate:
What are access specifiers? Should I inherit with private, protected or public?
Difference between private, public and protected inheritance in C++
To all you cpp experts,
In c++ inheritance,
class B : public A {
};
I am just curious why is the keyword public needed here? Does it mean something?
It means
publicmembers inAare inherited byBand are also public fromB.The alternatives are:
protected – public members from
Aare made protected inB, others are kept the same.private – all members from
Aare made private inB.The rules don’t apply to methods that are hidden or overriden.