Data and function in which area of a class are directly accessible outside the class ?

A. Public

B. Private

C. Protected

D. None of these

Answer : A. Public

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

Categorized in: