readonly1 [타입스크립트] readonly(읽기전용) 예제 클래스 Word의 프로퍼티가 public이므로 kimchi.def이 수정이 가능하다 type Words = { [key:string]: string } class Dict { private words: Words constructor(){ this.words = {} } add(word:Word) { if(this.words[word.term] === undefined) { this.words[word.term] = word.def } } def(term:string) { return this.words[term] } delete(term:string) { delete this.words[term] } } class Word { constructor( public term: string, publi.. 2022. 11. 15. 이전 1 다음