public class MyDeriveClass :MyBaseClass { public MyDeriveClass() :base() { } int derive_int = 1; } public class MyBaseClass { public MyBaseClass() { } int base_int = 1; } var cls = new MyDeriveClass(); 调用顺序如下: derive_int = 1; base_int = 1; MyBaseClas…
关于父类引用指向子类对象 例如: 有以下2个类 public class Father { public int age = 70; public static string name = "父亲"; } public class Son : Father { public int age = 30; public static string name = "儿子"; } Father f=new Son(); 这种用法叫做"父类引用指向子类对象,或者叫&…