public Student(string name,char sex,int age,int chinese,int math, int english)
{ this.name = name; this.sex = sex; this.age = age;
this.chinese = chinese; this.english = english; this.math = math;
}
这样建完之后,要给其中的类赋值是要再写一遍吗,比如这样
char sex;
public char Sex
{
get { return sex; }
set {
if (value == '男' || value == '女')
{
sex = value;
}
else { sex = '男'; }
}
}
|