jacob deiter wrote:
narrowing down the privilege of the overridden method in child class will also give you compile time error.
can you give some example?
in your reply, you says that private method of base class can be overridden in sub class.
if it so then protected method of base class can not be overridden in sub class ??
What amitabh meant is the following:
- a public method must be public in any sub class.
- a protected method must be protected or public in any sub class
- a method with default access must have default access or be protected or public in any sub class
In other words, you can't reduce the visibility.
This is not really related to your initial question though.