classDiagram
class Student {
- studentId: String
- name: String
- birthDate: Date
- gender: String
- className: Class
+ displayInfo(): void
}
class Course {
- courseId: String
- courseName: String
- teacher: Teacher
- credits: int
}
class Teacher {
- teacherName: String
- teacherId: String
+ displayInfo(): void
}
class StudentRepository {
+ addStudent(student: Student): void
+ removeStudent(studentId: String): void
+ updateStudent(student: Student): void
+ getStudent(studentId: String): Student
+ getAllStudents(): List<Student>
}
class CourseRepository {
+ addCourse(course: Course): void
+ removeCourse(courseId: String): void
+ updateCourse(course: Course): void
+ getCourse(courseId: String): Course
+ getAllCourses(): List<Course>
}
class StudentManagement {
- studentRepo: StudentRepository
+ addStudent(student: Student): void
+ removeStudent(studentId: String): void
+ updateStudent(student: Student): void
+ displayStudentInfo(studentId: String): void
}
class CourseManagement {
- courseRepo: CourseRepository
+ addCourse(course: Course): void
+ removeCourse(courseId: String): void
+ updateCourse(course: Course): void
+ displayCourseInfo(courseId: String): void
}
class Class {
- className: String
+ getClassName(): String
+ setClassName(name: String): void
}
class DependencyInversion {
+ StudentRepository
+ CourseRepository
}
Student --|> Class
Course --|> Teacher
StudentRepository --|> Student
CourseRepository --|> Course
StudentManagement --> StudentRepository
CourseManagement --> CourseRepository
Class --|> DependencyInversion
Teacher --|> DependencyInversion
标签:String,--,void,类图,Course,Student,class
From: https://www.cnblogs.com/Aidan347/p/17874558.html