静态属性 静态构造函数 构造函数 属性 子类 实现顺序

 internal class Program
    {
        private static void Main(string[] args)
        {
            var ret = 2 &1;
         //  B.Print();
            new TestB();
            Console.Read();
        }
    }

    public class Log
    {
        public Log(string str)
        {
            Console.WriteLine(str);
        }
    }

    public class TestA
    {
        public static Log log = new Log("a1");
        public  Log log1 = new Log("a2");

        static TestA()
        {
            new Log("a3");
        }

        public TestA()
        {
            new Log("a4");
        }
    }

    public class TestB:TestA
    {
        public static Log log = new Log("b1");
        public Log log1 = new Log("b2");

        static TestB()
        {
            new Log("b3");
        }

        public TestB()
        {
            new Log("b4");
        }
    }

执行结果:

b1
b3
b2
a1
a3
a2
a4
b4

posted @ 2015-04-12 23:45  N1900  阅读(159)  评论(0)    收藏  举报