C#单继承

using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace MyAplication {

编程学习网为您整理以下代码实例,主要实现:C#单继承,希望可以帮到各位朋友。

using System;
using System.Collections.Generic;
using System.linq;
using System.Text;

namespace MyAplication {
   class Demo {
      static voID Main(string[] args) {
         // Father class
         Father f = new Father();
         f.display();

         // Son class
         Son s = new Son();
         s.display();
         s.displayOne();

         Console.ReadKey();
      }

      class Father {
         public voID display() {
            Console.Writeline("display");
         }
      }

      class Son : Father {
         public voID displayOne() {
            Console.Writeline("displayOne");
         }
      }
   }
}

本文标题为:C#单继承