您的位置:首页 > 其它

深入.NET 第六章 上机1

2017-02-24 15:21 204 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 深入.NET_第六章_上机
{
class Program
{
static void Main(string[] args)
{
Truck truck = new Truck("奥迪A6","德国");
truck.VehiceRun();
truck.TruckRun();
Console.ReadLine();

}
}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 深入.NET_第六章_上机
{
public class Truck:Vehicle
{
public Truck(string type,string place):base(type,place){}
public void TruckRun(){

Console.WriteLine("型号是{0},产地为{1}的卡车在行驶!",this.Type,this.Place);
}

}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 深入.NET_第六章_上机
{
public class Vehicle
{
public string Type { get; set; }

public string Place { get; set; }
public Vehicle(string type, string place)
{
this.Type = type;
this.Place = place;
}
public void VehiceRun(){
Console.WriteLine("汽车在行驶!");
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: