构造函数执行顺序
- 不建议在构造函数中使用虚方法。
构造函数初始化语句
public class Parent
{
public Parent()
{
Console.WriteLine();
}
public Parent(string str)
{
Console.WriteLine();
}
}
public class Child : Parent
{
public Child()
{
Console.WriteLine();
}
public Child(string str) : base(str)
{
Console.WriteLine();
}
public Child(string str1, string str2) : this(str1)
{
Console.WriteLine();
}
}