1.

If all the members are defined in protected specifier then? (Constructors not considered)(a) Instance of class can’t be created(b) Instance of class can be created anywhere(c) Instance of class can be created only in subclasses(d) Instance of class can be created only in main() functionI have been asked this question in an internship interview.This key question is from Protected Access Specifier in division Access Specifiers of Object Oriented Programming

Answer»

The correct CHOICE is (b) Instance of CLASS can be created anywhere

The explanation is: The instances can be created anywhere in the PROGRAM. This is because the constructors are not considered among the MEMBERS defined in protected mode. Hence the default implicit constructor will be used WHENEVER an object is created.



Discussion

No Comment Found

Related InterviewSolutions