1.

If a class have default constructor defined in private access, and one parameter constructor in protected mode, how will it be possible to create instance of object?(a) Define a constructor in public access with different signature(b) Directly create the object in the subclass(c) Directly create the object in main() function(d) Not possibleThis question was addressed to me in my homework.My doubt stems from Protected Access Specifier topic in chapter Access Specifiers of Object Oriented Programming

Answer»

Right OPTION is (a) DEFINE a CONSTRUCTOR in public access with different signature

Easiest EXPLANATION - If a NEW constructor is defined in public access. That will be available to the whole program. Only restriction will be of the way to use it.



Discussion

No Comment Found

Related InterviewSolutions