关于在不同位置的初始化
public partial class Form1 : Form{
Student student;
Teacher teacher;
public Form1()
{
InitializeComponent();
teacher = new Teacher("");
student = new Student("蜗");
}
!!!!!!!!!!!!!!!!!!!!!!!!!!!
private void button1_Click(object sender, EventArgs e)
{
Teacher teacher = new Teacher("");
Student student = new Student("");
}
这两种初始化有什么区别吗?