以下类定义是正确的。
public static class Employee
{
string eNo;
string name;
bool gender;
DateTime birthday;
public string ENo { get => eNo; set => eNo = value; }
public string Name { get => name; set => name = value; }
public bool Gender { get => gender; set => gender = value; }
public DateTime Birthday { get => birthday; set => birthday = value; }
public Employee()
{
this.Gender=true;
this.Birthday=DateTime.Now;
}
}
正确
错误
public static class Employee
{
string eNo;
string name;
bool gender;
DateTime birthday;
public string ENo { get => eNo; set => eNo = value; }
public string Name { get => name; set => name = value; }
public bool Gender { get => gender; set => gender = value; }
public DateTime Birthday { get => birthday; set => birthday = value; }
public Employee()
{
this.Gender=true;
this.Birthday=DateTime.Now;
}
}
正确
错误