Which among the following best describes the protected specifier?

Đạt Michio

New member
Which among the following best describes the protected specifier?
A. Members are most secure and can’t be used outside class
B. Members are secure but can be used outside the class
C. Members are secure as private, but can be inherited
D. Members are secure like private, but can’t be inherited
 
Answer: c
Explanation: The members which are made protected, are most secure if inheritance is not used. But, this facility is provided to keep those members private and with that, they can be inherited by other classes. This is done to make the code more flexible.
 

Tìm kiếm

Back
Top