How I should make something like that in Java?
Right now I've this:
public class Person {
String name;
String surName;
Integer yearOfBirth;
//Constructors, Getters, Setters and Methods
}
public class Professor extends Person {
String department;
//Constructors, Getters, Setters and Methods
}
// Two Childs of Professor
public class DepartmentProfessor {
String departmentName;
//Constructors, Getters, Setters and Methods
}
I'm very newbie to UML, if I understood correctly, Professor has to be an interface and DepartmentProfessors have to implement it but then I've the problem of Person being superclass, have concrete methods, of Professor and it having two subclasses.
You are mistaken. Professor
is a simple class and DepartmentedProfessors
the same. Only that the latter depends on the first one (the dashed arrow line). This is because Professor
is used in a paramter of the operation addProfessor(Professor)
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.