Method overriding. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Method overriding.

The overriding method cannot be more restrictive than the overridden method. If the superclass method is public, then the overriding subclass method can neither be private nor protected. My question is, if the superclass method is protected, can the overriding subclass method be public?

25th Dec 2017, 11:23 AM
Kris Moore
Kris Moore - avatar
1 Answer
+ 7
Yes it can
25th Dec 2017, 11:35 AM
David Akhihiero
David Akhihiero - avatar