当前位置:首页 > C#教程 > C#进阶

C#多级继承

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Demo {
   class Son : Father {
      public void DisplayTwo() {
         Console.WriteLine("Son.. ");
      }

      static void Main(string[] args) {
         Son s = new Son();
         s.Display();
         s.DisplayOne();
         s.DisplayTwo();
         Console.Read();
      }
   }

   class Grandfather {
      public void Display() {
         Console.WriteLine("Grandfather...");
      }
   }

   class Father : Grandfather {
      public void DisplayOne() {
         Console.WriteLine("Father...");
      }
   }
}

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!