multitple1 Constructor overloading with default 변수 선언 후 생성자에서 할당 class Test { name: string; protected age: number; public id?: string; private password?: string; constructor(name = "", age = 0, id = undefined, password = undefined) { this.name = name; this.age = age; this.id = id; this.password = password; } }생성자에서 선언하고 변수 할당하기 => id, password class Test { name: string; protected age: number; constructor( name: string = "", age: number = 0, p.. 2022. 6. 25. 이전 1 다음