0
Why ob2.f(7) is Error? Aren't methods inherited ???
4 Antworten
+ 2
f is overridden in class B. So you can't pass it any argument. If you call it without argument or comment out f declaration in class B, it'll work fine.
+ 2
It's 'coz you've overridden the method f in class B to take no arguments. Thus calling it with an argument, f(7), will obviously raise an error.
+ 2
I thought that f () is overridden, and f (int) is inherited
+ 1
Thanx