C++ Programmer Question:
Download Job Interview Questions and Answers PDF
Explain me what do you mean by C++ access specifiers?
Answer:
Access specifiers are used to define how the members (functions and variables) can be accessed outside the class. There are three access specifiers defined which are public, private, and protected
☛ private:
Members declared as private are accessible only with in the same class and they cannot be accessed outside the class they are declared.
☛ public:
Members declared as public are accessible from any where.
☛ protected:
Members declared as protected can not be accessed from outside the class except a child class. This access specifier has significance in the context of inheritance.
☛ private:
Members declared as private are accessible only with in the same class and they cannot be accessed outside the class they are declared.
☛ public:
Members declared as public are accessible from any where.
☛ protected:
Members declared as protected can not be accessed from outside the class except a child class. This access specifier has significance in the context of inheritance.
Download C++ Programmer Interview Questions And Answers
PDF