about derived class access specifier

Hello, i was reading this tutorial
http://cplusplus.com/doc/tutorial/inheritance/
where i found this piece of code

class CRectangle: public CPolygon {

what is the significance of the specifier public here. what would happen if i use private or protected?
can someone explain?
it'd because CRectangle can inherit all members(private, protected and public) of CPolygon and so CRectangle can use all...
Imagine that the public, protected and private were enumerated values, with public=1, protected=2, and private=3;
Then for each member of the base class, it's access specifier in the derived class would be max(inheritance_access_specifier, base_class_access_specifier)
So, if the inheritance acces level is private, everything is private. If it's protected, everything is protected or stricter, and if it's public, everything is as it was in the base class.
Last edited on
got it thanks
which ever specifier is more strict will be considered.
Topic archived. No new replies allowed.