1.

What is default access specifier for data members or member functions declared within a class without any specifier, in C++?(a) Private(b) Protected(c) Public(d) Depends on compilerI got this question in my homework.This intriguing question originated from Classes in chapter OOPs Concept & Features of Object Oriented Programming

Answer»

Right answer is (a) Private

Easiest explanation - The DATA members and MEMBER FUNCTIONS are Private by default in C++ classes, if NONE of the access specifier is used. It is actually made to increase the PRIVACY of data.



Discussion

No Comment Found

Related InterviewSolutions