写完后测试,什么都没显示,求指教是什么原因? 谢谢!
class Program
{
static void Main(string[] args)
{
Student i = new Student();
i.Name = "小明";
i.age = 16;
i.Habit = "喜欢弹钢琴";
Teacher l = new Teacher();
l.Name = "李明";
l.age = 27;
l.exp = 5;
Console.ReadKey();
}
}
class Student
{
public string Name;
public int age;
public string Habit;
public void SayHello()
{
Console.WriteLine("大家好,我叫{0},我今年{1}岁,我的爱好是{2}", Name, age, Habit);
}
}
class Teacher
{
public string Name;
public int age;
public int exp;
public void SayHello()
{
Console.WriteLine("大家好,我叫{0},我今年{1}岁,我工作了{2}年了", Name, age, exp);
}
}