- #1
yungman
- 5,755
- 293
I studied about 20 pages, I understand the base class access specification as shown;
My question is why is it necessary to have private and protected base class access specification? If z is public in Base class, other programs can access z directly regardless the Derived class say it's private or protected. Is there really real use for declaring private or protected?Regarding to Constructors, is declaring constructor DerivedClass() : BaseClass() only to save some lines of declaring some default values of the variable and function. That if you are willing to type the extra lines on constructor DerivedClass(){}, you do not need to do this fancier way?
Thanks
My question is why is it necessary to have private and protected base class access specification? If z is public in Base class, other programs can access z directly regardless the Derived class say it's private or protected. Is there really real use for declaring private or protected?Regarding to Constructors, is declaring constructor DerivedClass() : BaseClass() only to save some lines of declaring some default values of the variable and function. That if you are willing to type the extra lines on constructor DerivedClass(){}, you do not need to do this fancier way?
Thanks