I have four classes. Request, DerivedRequest, Handler, DerivedHandler. The Handler class has a property with the following declaration:
public abstract Request
This isn't really a good way to structure things. Do one of the following
1) Just don't change the return type, and override it normally in the subclass. In DerivedHandler you can return an instance of DerivedRequest using the base class signature of Request. Any client code using this can choose to cast it to DerivedRequest if they want to.
2) Use generics instead if they are not supposed to be polymorphic.
public abstract class HandlerBase where T: Request
{
public abstract T Request {get;set;}
}
public class Handler: HandlerBase()
public class DerivedHandler: HandlerBase()