@2023/09/19 안녕하세요 lika-7입니다이번 시간에는 TypeScript의 클래스와 접근제어자에 대해 정리하겠습니다클래스 기본 문법//TypeScript class UserA { constructor(first:string, last:string, age:number){ this.first = first this.last = last this.age = age } getAge(){ return `${this.first} ${this.last} is ${this.age}` } }클래스를 선언하는 위의 문법은 자바스크립트 문법에서는 문제가 없습니다.하지만 타입스크립트에서 위와 같이 클래스를 선언하면 문제가 생깁니다UserA안에 first의 내용이 없다고 나옵니다. last와 age 또한 마찬가지 입..
클래스와 접근 제어자
@2023/09/19 안녕하세요 lika-7입니다이번 시간에는 TypeScript의 클래스와 접근제어자에 대해 정리하겠습니다클래스 기본 문법//TypeScript class UserA { constructor(first:string, last:string, age:number){ this.first = first this.last = last this.age = age } getAge(){ return `${this.first} ${this.last} is ${this.age}` } }클래스를 선언하는 위의 문법은 자바스크립트 문법에서는 문제가 없습니다.하지만 타입스크립트에서 위와 같이 클래스를 선언하면 문제가 생깁니다UserA안에 first의 내용이 없다고 나옵니다. last와 age 또한 마찬가지 입..
2023.09.19