[C#] C# 虚函数使用范例 →→→→→进入此内容的聊天室

来自 , 2019-11-17, 写在 C#, 查看 103 次.
URL http://www.code666.cn/view/52dfa8e7
  1. using System;
  2. namespace Test2 {
  3.    class Plane {
  4.       public double TopSpeed() {
  5.          return 300.0D;
  6.       }
  7.    }
  8.    class Jet : Plane {
  9.       public double TopSpeed() {
  10.          return 900.0D;
  11.       }
  12.    }
  13.    class Airport {
  14.       static void Main(string[] args) {
  15.          Plane plane = new Jet();
  16.          Console.WriteLine("planes top speed: {0}",plane.TopSpeed());
  17.          Console.ReadLine();
  18.       }
  19.    }
  20. }
  21.  
  22. //csharp/4820

回复 "C# 虚函数使用范例"

这儿你可以回复上面这条便签

captcha