Using Public, Private,a nd Protected to Disallow Access to Certain Member Functions
Posted on 2003-03-29
I have a BaseClass with 5 member functions: func1, func2, func3, func4, func5.
I want to create derived classes from BaseClass:
- DerivedClass1 must be able to access all member functions in BaseClass except func5.
- DerivedClass2 must be able to access all member functions in BaseClass except func1.
Is there a way that I can use access specifiers public, protected and private to structure my code in such a way that it restrict access BaseClass functions as indicated?
If anyone knows how I can achieve this result I would appreciate some assistance. Thank you.