C++ Access Control Question:
Download Questions PDF

Do you know private, protected and public access control?


Private is the default access specifier for every declared data item in a class. Private data belongs to the same class in which it is created and can only be used by the other members of the same class.

When a data item is declared as protected it is only accessible by the derived class member.

Public allows to use the declared data item used by anyone from anywhere in the program. Data items declared in public are open to all and can be accessed by anyone willing to use their values and functions they provide.

Download C++ Access Control Interview Questions And Answers PDF

Previous QuestionNext Question
What is Protected Inheritance?Default return type of functions in CPP is:

a. void
b. long
c. char
d. int