标签:line reading sed name 汽车 space ase eric color
1 =============Truck类========== 2 using System; 3 using System.Collections.Generic; 4 using System.Linq; 5 using System.Text; 6 using System.Threading.Tasks; 7 8 namespace SJ1.entity 9 { 10 /// <summary> 11 /// 卡车类 12 /// </summary> 13 public class Truck : Vehicle 14 { 15 public Truck(string xinghao, string chandi):base(xinghao,chandi) 16 {} 17 /// <summary> 18 /// TruckRun() 19 /// </summary> 20 public void TruckRun() 21 { 22 Console.WriteLine(string.Format("型号是:{0},产地是{1}的卡车在行驶!",Xinghao,Chandi)); 23 } 24 } 25 26 }
1 =============Vehicle类============== 2 using System; 3 using System.Collections.Generic; 4 using System.Linq; 5 using System.Text; 6 using System.Threading.Tasks; 7 8 namespace SJ1.entity 9 { 10 /// <summary> 11 /// 汽车类 12 /// </summary> 13 public class Vehicle 14 { 15 public string Xinghao { get; set; } //型号 16 public string Chandi { get; set; } //产地 17 /// <summary> 18 /// 构造函数 19 /// </summary> 20 /// <param name="xinghao"></param> 21 /// <param name="chandi"></param> 22 public Vehicle(string xinghao, string chandi) 23 { 24 this.Xinghao = xinghao; 25 this.Chandi = chandi; 26 } 27 /// <summary> 28 /// VehiclRun()方法 29 /// </summary> 30 public void VehicleRun() 31 { 32 Console.WriteLine("汽车在行驶"); 33 } 34 } 35 }
1 =============测试类============== 2 using SJ1.entity; 3 using System; 4 using System.Collections.Generic; 5 using System.Linq; 6 using System.Text; 7 using System.Threading.Tasks; 8 9 namespace SJ1 10 { 11 class Program 12 { 13 static void Main(string[] args) 14 { 15 Truck truck = new Truck("奥迪A6","德国"); 16 truck.TruckRun(); 17 truck.VehicleRun(); 18 Console.Read(); 19 20 } 21 } 22 }
(深入.Net平台和C#编程)第六章上机练习1.李向阳.20170411
标签:line reading sed name 汽车 space ase eric color
原文地址:http://www.cnblogs.com/qq2835200767/p/6691758.html