Question 65
Let A be the base class in C++ and B be the derived class from A with protected inheritance. Which of the following statement is false for class B?
Explanation
Previous | Next |
UGC NET CS December 2019 - Question 64 | UGC NET CS December 2019 - Question 66 |
In this case, the members of the base class can be used only within the derived class as protected members except for the private members.
TRUE: Member function of class B can access protected data of class A
TRUE: Member function of Class B can access public data of class A
TRUE: Member function of class B cannot access private data of class A
FALSE: Object of derived class B can access public base class data
Private and protected member variables of a derived class are not accessed by using direct member access operator
Given option 4 statement is false.
So, option 4 is correct answer
Reference with example: C++ Access Specifiers - Protected Access Specifier