Computer Science - Object Oriented Programming Using C++ - Discussion

Discussion Forum : Object Oriented Programming Using C++ - Section 3 (Q.No. 8)
8.
When a class is derived from another derived class, the newly derived class
may have more liberal access to a base class member than its immediate predecessor
may have the same type of access to a base class member as its immediate predecessor
may have more limited access to a base class member than its immediate predecessor
both (b) and (c)
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
2 comments Page 1 of 1.

Ravi said:   9 years ago
The Answer is 'C' and NOT 'D' because.

Let us have one base class (parent) from which we can have derived class (child). Now again, according to statement given, the existing child class will become parent when we create child class of this child class. Let us look it this way, grand parent, parent and child.

Now the protected members of grandparent class can be used only by parent class and cannot be used by child class. However, the protected members of parent class can be used by its child class.

So, answer is 'C'.

Hope This explanation is simple enough.

Bedant said:   9 years ago
Why answer is not D?. Because if there is no private or protected member in the base class, then newly derived class and the immediate predecessor will have same access to base class.

Post your comments here:

Your comments will be displayed after verification.