Suppose you have three classes:
class A {}
class B : A { public string S { get; set ; } }
class C : B { public string S2 { get; set ; } }
So C is derived from B which is derived from A.
That means that instances of both C & B are instances of A plus a bit, and that a C instance is also an instance of B. But that A is not a B or a C, and B is not a C.
A -> B -> C
So it's pretty obvious that you can assign an instance of B or C to a variable of type A:
A a = new B();
a = new C();
But you can't so it the other way around:
B b = new C();
b = new A();
If you could, then you'd have problems when you tried to access
b.S
because an instance of A does not contain the variable at all.
With that - hopefully - clear, let's look at what you are doing.
return sc.MemberwiseClone();
MemberwiseClone returns an
object
because that is the base class for
everything - all other classes implicitly derive from object. So when you return a SimpleClass you have to cast that object to your class or I could do this:
string LetSlipTheDogsOfWar(int i)
{
object o = i;
return o;
}
...
string s = LetSlipTheDogsOfWar(666);
The system rightly complains that you are doing something very dangerous!