협력, 객체, 클래스

객체 지향 프로그래밍의 지향점

도메인

도메인 구조 기반으로 클래스 구현하기

public class Screening {
    **private** Movie movie;
    private int sequence;
    private LocalDateTime whenScreened;

    **public** Screening(Movie movie, int sequence, LocalDateTime whenScreened) {
        this.movie = movie;
        this.sequence = sequence;
        this.whenScreened = whenScreened;
    }

    public LocalDateTime getStartTime() {
        return whenScreened;
    }

    public boolean isSequence(int sequence){
        return this.sequence == sequence;
    }

    public Money getMovieFee() {
        return movie.getFee();
    }
}

자율적인 객체와 프로그래머의 자유