定义汽车类
来源:百度知道 编辑:UC知道 时间:2024/09/24 23:26:32
要求:1、在CAR类中加main()方法,测试程序的运行结果。
用c#写的 不知道可以么?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace car
{
public class car
{
private string name;
private int id;
private string output = " ";
public car() { }
public car(string name, int id)
{
this.name = name;
this.id = id;
}
public string Name
{
get { return name; }
set { name = value; }
}
public int ID
{
get { return id; }
set { id = value; }
}
public string Addspeed()
{
return output = " 汽车加速!";
}
public string Stopspeed()
{
return output =" 汽车刹车! ";