posted 13 years ago
Because there is an is a relationship between the superclass and the subclass (the Liskov substitution principle that Rob mentioned). If this were allowed, there would be a backdoor through which you could call methods that should not be accessible.
You can assign an instance of a subclass to a variable that has the type of the superclass:
The call in line 17 would be possible, because method() is public in class Super. But it should not be allowed, because obj is really referring to an instance of Sub, and in that class, the method is protected! So, there is a backdoor through which you could now suddenly call a method in class Sub that should not be accessible from the outside.
To prevent this, it's not allowed to give an overriding method more restricted access than the method it is overriding.