If all the members are defined in protected specifier then? (Constructors not considered)

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() function
 
Answer: b
Explanation: 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.
 

Tìm kiếm

Back
Top