class Program
{
static void Main(string[] args)
{
Father objFather = new Son(); //Ok compiles
Son objSon1 = new Father(); //Comile time error : Cannot implicitly convert type
Son objSon = (Son)new Father(); //Run time error
Console.ReadLine();
}
}
class Father
{
public void Read()
{
}
}
class Daughter:Father
{
}
class Son:Father
{
}
任何人都可以解释为什么会这样吗?内存中发生了什么?