I have a class inheritance as follows.
public virtual class A{
public virtual A myMethod(){
return new A();
}
}
public class B extends A{
public override B myMethod(){
return new B();
}
}
But it throws an compile error:
Method return types clash: myMethod()
And my question is How to return child type instead of father type when overriding a method?