1.

Which access specifier is/are most secure during inheritance?(a) Private(b) Default(c) Protected(d) Private and defaultI had been asked this question by my school principal while I was bunking the class.Origin of the question is Private Access Specifier in portion Access Specifiers of Object Oriented Programming

Answer» RIGHT choice is (a) Private

Easiest EXPLANATION - The private members are most secure in inheritance. The default members can still be in INHERITED in special cases, but the private members can’t be ACCESSED in any case.


Discussion

No Comment Found

Related InterviewSolutions