Overriding methods in Java
Let
public class A{
public MyType myMethod(){...}
}
and
public class B extends A{
@Override
public MyType myMethod(){...}
}
be an arbitrary classes. Why MyType must be a parent type of
MyAdvancedType necessarily? What happened if we permitted that
MyAdvancedType can be an arbitrary type?
No comments:
Post a Comment