{
class Program
{
static void Main(string[] args)
{
// DriveB d = new DriveB();
DriveC f = new DriveC();
}
}
class BaseA
{
DisplayClass BaseA_c = new DisplayClass("基类实例变量BaseA_c初始化");
static DisplayClass a = new DisplayClass("基类静态成员初始化");
public BaseA()
{
Console.WriteLine("基类构造方法被调用A");
}
static BaseA()
{
Console.WriteLine("基类静态构造方法被调用A");
}
}
class DriveB : BaseA
{
static DisplayClass DriveB_b = new DisplayClass("继承类静态成员DriveB_b初始化");
//static BaseA DriveB_a = new BaseA();
DisplayClass DriveB_c = new DisplayClass("继承类实例变量DriveB_c初始化");
public DriveB()
{
Console.WriteLine("继承类构造方法被调用B");
}
static DriveB()
{
Console.WriteLine("继承类静态构造方法被调用B");
}
}
class DriveC : DriveB
{
static DisplayClass DriveC_d = new DisplayClass("继承类静态成员DriveC_d初始化");
DisplayClass DriveC_e = new DisplayClass("继承类实例成员DriveC_e初始化");
static DriveC()
{
Console.WriteLine("继承类静态构造方法被调用C");
}
public DriveC()
{
Console.WriteLine("继承类构造方法被调用C");
}
}
class DisplayClass
{
public DisplayClass(string diplayString)
{
Console.WriteLine(diplayString);
Console.WriteLine();
}
}
}