Home > Back-end >  Pray,, every man be silly, don't understand at all
Pray,, every man be silly, don't understand at all

Time:10-31


Package the user;
/* *
*
* @ the ClassName: Student
* @ Description: student model classes: used to encapsulate the student information,
* @ author zhoushaobin
* @ date on July 7, 2017,
*
*/

Public class Student extends the User {
private String sex;
private int age;
Private String department;
Public Student (String studentNo, String name, String sex, int the age, the String department) {
Super (studentNo, name, User. USER_TYPE_STUDENT);
This. Sex=sex;
this.age=age;
This. The department=department;
}
Public Student (String studentNo, String name) {
This (studentNo, name, "male", 19, "computer science");
}
Public String getSex () {
Return sex;
}
Public void setSex (String sex) {
This. Sex=sex;
}
Public int getAge () {
Return the age;
}
Public void setAge (int age) {
this.age=age;
}
Public String getDepartment () {
Return department;
}
Public void setDepartment (String department) {
This. The department=department;
}
Public Boolean equals (Object o) {
If (o instanceof Student) {
Student s=(Student) o;
Return this. GetUserNo (.) the equals (s.g etUserNo ());
} else {
return false;
}
}

}
Then what the hell is in this modification

CodePudding user response:

In the urine of code style, is to add a
Public Boolean deleteStudent () {... . }
Methods, and realize the function to delete a student information,
Or, if there is a similar approach in the base class, you can override.

CodePudding user response:

Eldest brother, and the source code?

CodePudding user response:

Don't understand say what

CodePudding user response:

Java's problem to c + + Builder BBS to asking, can ask the answer is a miracle
  • Related