인터페이스와 클래스 - 클래스

/**
 * 인터페이스와 클래스
 */

// 여기서의 인터페이스는 마치 클래스의 설계도 역할
// -> 인터페이스는 무조건 public 필드
interface CharacterInterface {
    name: string;
    moveSpeed:number;
    move(): void;
}

class Character implements CharacterInterface {

    constructor(public name: string, public moveSpeed: number){}

    move(): void{
        console.log(`${this.moveSpeed} 속도로 이동!`)
    }
}