struct Teacher
{
public string Name;
public uint Age;
public string Phone;
public string Address;
public void Eat()
{
Console.WriteLine("TEACHER GO HOME FOR DINNER!");
}
public Teacher(string name, uint age, string phone, string address)
{
this.Name = name;
this.Age = age;
this.Phone = phone;
this.Address = address;
}
}
private void button1_Click(object sender, EventArgs e)
{
Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++++++++++");
Teacher t = new Teacher("TOM SON", 35, "13381335310", "BEIJING");
//通过构造函数重载实例化结构对象
Console.WriteLine("TEACHER NAME={0},AGE={1},TEL={2},ADDRESS={3}", t.Name,
t.Age, t.Phone, t.Address);
t.Eat();