Typescript(7) - Class
·
Typescript
Class TypeScript에서 클래스(Class)는 객체 지향 프로그래밍(OOP)의 핵심 개념 중 하나로, 객체를 생성하기 위한 템플릿 또는 청사진(blueprint)입니다. 클래스를 사용하여 객체의 상태와 행위를 정의하고, 해당 클래스로부터 여러 개의 객체(인스턴스)를 생성할 수 있습니다. class Car { constructor(color){ this.color = color; } start() { console.log("start"); } } const bmw = new Car("red"); 에러를 발생합니다. color라는 프로퍼티가 Car에 존재하지 않는다고 합니다. class Car { color: string; constructor(color: string){ this.color = c..