Given the following classes:
ClassA
{
public ClassA DoSomethingAndReturnNewObject()
{}
}
ClassB : ClassA
{}
ClassC : ClassA
{}
What you're describing is a covariant return type and is not supported in C#.
However, you could create ClassA as an open generic and have the closed generic inheritors return their own type.
Example:
public abstract class ClassA where T: ClassA, new()
{
public abstract T DoSomethingAndReturnNewObject();
}
public class ClassB: ClassA
{
public override ClassB DoSomethingAndReturnNewObject()
{
//do whatever
}
}