Which of the following are available only in the class hierarchy chain ?

A. Public data members

B. Private data members

C. Protected data members

D. Member functions

Answer : C. Protected data members

Explanation :

  • Public – The members declared as Public are accessible from outside the Class through an object of the class.
  • Protected – The members declared as Protected are accessible from outside the class but only in a class derived from it.
  • Private – These members are only accessible from within the class. No outside Access is allowed.
  • Member Function – Member functions are the functions, which have their declaration inside the class definition and works on the data members of the class. The definition of member functions can be inside or outside the definition of class.

Categorized in: