Given the following classes:
ClassA
{
public ClassA DoSomethingAndReturnNewObject()
{}
}
ClassB : ClassA
{}
ClassC : ClassA
{}
There's one really simply answer: make all the method return types "object". You're obviously returning different types, strings and ints and whatnots, and they will stay what they are after they reach their destination. But the compiler is perfectly happy - everything's an "object". You do give up compile-time type-checking, not a good thing, but every once in a while for some deep OO programming the return is worth it.