2022/04/08

    [바미] 서로가 서로를 필요로 할 때

    class ExamClass { constructor() { ... this.init(); } init() { this.A = new constructorA(this.B); this.B = new constructorB(this.A); this.C = new constructorC(this.A, this.B); } } 위처럼 A는 A를 생성하기 위해 B가 필요하고, B는 B를 생성하기 위해 A가 필요하는 상황이였습니다. 그 때는 ExamClass를 사용하여 해결하였습니다. class ExamClass { constructor() { ... this.init(); } init() { this.A = new constructorA(this); this.B = new constructorB(this.A); t..