using System;
public class Starter {
public static void Main() {
XClass obj = new XClass();
}
}
public class MyClass {
public MyClass(int param) {
Console.WriteLine("MyClass constructor");
}
}
public class YClass : MyClass {
public YClass(int param) : base(YClass.MethodA()) {
Console.WriteLine("YClass constructor");
}
public static int MethodA() {
Console.WriteLine("YClass constructor initializer");
return 0;
}
}
public class XClass : YClass {
public XClass() : base(XClass.MethodA()) {
Console.WriteLine("XClass constructor");
}
public static new int MethodA() {
Console.WriteLine("XClass constructor initializer");
return 0;
}
}
|