inherit

时间:2023-03-09 05:08:54
inherit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace
{
class Program
{ static void Main(string[] args)
{ goHomeByTrain bytrain = new goHomeByTrain(); bytrain.sele(); }
} public class goHomeByTrain : selebreate
{
protected override void GoHomeBy()
{
Console.WriteLine("go home by train!");
} } public abstract class selebreate
{
public void sele()
{
BookTicket();
GoHomeBy();
SelebreateFe();
} protected virtual void GoHomeBy()
{
Console.WriteLine("go home by ...");
}
protected void SelebreateFe()
{
Console.WriteLine("selebreate Spring Festival ");
}
protected void BookTicket()
{
Console.WriteLine ("Book ticket!");
} }
}