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
时间: 2024-10-12 20:52:47