Contents
- Types of Class Relationships in Class Diagram
Association Class
Whole-part relationship
Inheritence relationship

Enrolls에 해당하는 association에 대해 클래스로 표현하고, 이 클래스에 grade를 추가 (이를 연관 클래스라고 함)

public class Enrollment {
private char grade;
private Student[] student;
private Course[] course;
}
public class Student {
private List<Enrollment> enrolls;
}
public class Course {
private List<Enrollment> enrolls;
}

public class Employment {
private int salary;
private Date startDate;
private Company[] company;
private Person[] person;
}
public class Company {
private List<Employment> employments;
}
public class Person {
private List<Employment> employmentss;
}
전체 개념에 해당하는 클래스(Whole)와 이를 이루는 부품에 해당하는 클래스(Part)간의 관계
자동차와 바퀴는 자동차가 Whole이고 바퀴가 Part
특별한 형태의 연관 관계라고 볼 수 있으며, 다음과 같은 상황에서 전체/부분 관계를 생각
부분 개념이 모여서 전체 개념을 이룰 때 (is part of)
어떤 클래스가 집합 개념을 가지며 구성하는 부분들을 소유하는 관계 (own)
Transitive property
If A is part of B, and B is part of C, then A is also part of C
Asymmetric property
It is not possible that "A is part of B" and "B is part of A" at the same time


위 그림의 Multiplicity를 보면 LectureHall이 없어도(0) Beamer는 존재할 수 있다. 하지만, Lecturehall과 합성 관계이기 때문에 LectureHall 객체가 삭제되면 Beamer 객체 역시 사라진다.

### Composition Relationship
class Office:
def __init__(self, room_number, phone_number):
self.room_number = room_number
self.phone_number = phone_number
class Employee:
def __init__(self, room_number, phone_number):
self.office = Office(room_number, phone_number)

### Aggregation Relationship
class Office:
def __init__(self, room_number, phone_number):
self.room_number = room_number
self.phone_number = phone_number
class Employee:
def __init__(self, office):
self.office = office
class main:
office_100 = Office("100", "423-434")
e1 = Employee(office_100)
e2 = Employee(office_100)


레전드 미친 중복 attribute 발생