using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _05base關鍵字
{
//顯示的調用父類的構造函數
//調用父類中的重名方法
class Program
{
static void Main(string[] args)
{
Student s = new Student();
Console.ReadKey();
}
}
public class Person
{
public void Test()
{
Console.WriteLine("我是父類");
}
}
public class Student:Person
{
public /*new*/ void Test()//new在子類中隱藏父類繼承過來的方法
{
base.Test();
Console.WriteLine("我是子類");
}
}
}