I have a question about construct a object
public class MyBase
{
public MyBase()
{
Console.WriteLine("MyBase Construct");
}
public MyBase(int i)
{
Console.WriteLine("MyBase Construct one");
}
}
public class MyDerivedClass : MyBase
{
public MyDerivedClass(int i)
{
Console.WriteLine("MyDerivedClass Construct one");
}
}
The author said that the construct sequence is follow:
System.Object.Object()
MyBase.MyBase(int i)
MyDerivedClass(int i)
But when i construct a object like this;
MyDerivedClass myDervied = new MyDerivedClass(3);
The output is follow:
MyBase Construct
MyDerivedClass Construct one
So in my opinion the construct sequence is follow:
System.Object.Object()
MyBase.MyBase()
MyDerivedClass(int i)
I am a Chinese, I am not good at English,please forgive me for my syntax errors. and tell the answer about my problem,Thank you!!!
|