Muneeswaran wrote:In the above code,the getValue() in Tsuper(super class) has the default access specifier,In the TSub(Sub class) getValue has the protected access specifier,
According to the overrriding rules,
The overriding method is less restrictive than overriden method.But here the getvalue not statisfy the above condition.
Then how the above code compiles fine?.I can't understand
Hello Munees, the access modifiers goes like this 'from less restrictive to most restrictive';
public-protected-default-private
Use it to check the program again and you will understand why it compiles.
Regards
Ikpefua