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!");
        }

    }
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章