Which of the following access specifiers is used in a class definition by default ?

A. Protected

B. Public

C. Private

D. Friend

Answer : C. Private

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.
  • Friend – A friend function of a class is defined outside that class scope but it has the right to access all private and protected members of the class.

Categorized in:

C++

Tagged in:

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Share Article:

Leave a Reply

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
100% Free SEO Tools - Tool Kits PRO