天天看點

并程式設計對派出類的功能進行驗證。。 轎車類等 派生出自行車類 停車等方法。然後從該類為基類 最大速度。重量等字段以及開車 要求具有速度 定義一個車輛類

using System;class Che{protected int speed;protected int maxSpeed;protected int weight;public void Run(string name) { Console.WriteLine("我是" + name + "的開車方法"); }public void Stop(string name) { Console.WriteLine("我是" + name + "的停車方法"); }}class Bike : Che{}class Car : Che{}class Test{static void Main(){Bike b = new Bike();b.Run("自行車");b.Stop("自行車");Car c = new Car();c.Run("汽車");c.Stop("汽車");}}屬性字段沒有使用