1.-----構造函數
public class Human()
{
public Human()
{
Console.Write("Human Constructure Function");
}
}
Public Class Chinese():Human
{
public Chinese()
{
Console.Write("Chinese Constructure Function");
}
}
Class Program()
{
static void Main(string[] args)
{
Chinese ch = new Chinese();
}
}
結果:
Human Constructure Function
Chinese Constructure Function
先運行父類構造方法,再子類的