using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication7
{
class Car
{
private string Name;
private string color;
private string cd;
//Name
public string Name1
{
get { return Name; }
set { Name = value; }
}
//color
public string Color
{
get { return color; }
set { color = value; }
}
//产地
public string Cd
{
get { return cd; }
set { cd = value; }
}
public void Run()
{
Console.WriteLine("一辆{0}汽车,{1}颜色,产地是{2}",Name1,Color,Cd);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
Car h = new Car() { Name1="奔驰",Color="蓝", Cd = "德国" };
h.Run();
Console.ReadLine();
}
}
}