【入门】c#中的多层继承顺序和java的不一样,怎样才能一样?
using System;
namespace xumh
{
public class MyClass
{
public MyClass()
{
Console.WriteLine("MyClass:默认构造函数");
}
public MyClass(int a, int b)
{
Console.WriteLine("MyClass带参构造:a={0}, b={1}.", a, b);
}
}
public class MyClass2 : MyClass
{
public MyClass2()
{
Console.WriteLine("MyClass2:默认构造函数");
}
public MyClass2(int a, int b)
{
Console.WriteLine("MyClass2带参构造:a={0}, b={1}.", a, b);
}
}
public class MyClass3 : MyClass2
{
public MyClass3()
{
Console.WriteLine("MyClass3:默认构造函数");
}
public MyClass3(int a, int b)
{
Console.WriteLine("MyClass3带参构造:a={0}, b={1}.", a, b);
}
}
public class runMyApp
{
static void Main()
{
MyClass3 my = new MyClass3(3,4);
}
}