1.

Which access specifier is usually used for data members of a class?(a) Private(b) Default(c) Protected(d) PublicThe question was posed to me during an online exam.The origin of the question is Access Specifiers topic in section Access Specifiers of Object Oriented Programming

Answer»

Correct choice is (a) Private

To explain: All the data MEMBERS should be made private to ENSURE the HIGHEST security of data. In special cases we can USE public or protected access, but it is advised to keep the data members private always.



Discussion

No Comment Found

Related InterviewSolutions