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("汽车");}}属性字段没有使用
并编程对派出类的功能进行验证。。 轿车类等 派生出自行车类 停车等方法。然后从该类为基类 最大速度。重量等字段以及开车 要求具有速度 定义一个车辆类
最新推荐文章于 2021-09-02 13:04:15 发布