I have an abstract class with a method that i would like to return 'this' of the classes' subclasses. When i'm using the method i don't want it to return the object casted as MyClass and me have to recast it back to what it really is. Is there a pretty way of doing this with a generic?
abstract public class MyClass{
public <aSubClassOfMyClass> doSomething(){
return this;
}
}