1.

Which of the following describes the protected access specifier?(a) The variable is visible only outside inside the block(b) The variable is visible everywhere(c) The variable is visible to its block and to it’s derived class(d) The variable is not visible to its blockI have been asked this question during a job interview.My question is based upon Access Control in section Class Hierarchies, Library & Containers of C++

Answer» RIGHT choice is (c) The variable is visible to its block and to it’s derived class

Best explanation: Protected members are visible to its block and to the derived CLASSES and not visible to OUTSIDE objects or VARIABLES.


Discussion

No Comment Found

Related InterviewSolutions