C++ Access Control Question: Download C++ Access Control PDF

Explain different access specifiers for the class member in C++?

Tweet Share WhatsApp

Answer:

Access specifiers in C++ determines the scope of the class members.

Public: If a class member is public, it can be used anywhere without the access restrictions.

Private: if a class member is private, it can be used only by the members and friends of class.

Protected: If a class member is protected, it can be used only by the members and friends of class and the members and friends of classes derived from class.

Download C++ Access Control PDF Read All 31 C++ Access Control Questions
Previous QuestionNext Question
Do you know what is the default access level?What is Private Inheritance?