인터페이스와 클래스
클래스 이행 규칙
// 인터페이스 Button 정의
interface ButtonInterface {
onInit():void;
onClick():void;
}
// 클래스 Y9Button 인터페이스 Button 확장
class Y9Button implements ButtonInterface {
width:number;
height:number;
constructor(width, height) {
this.width = width;
this.height = height;
}
// [오류]
// 'Y9Button' 클래스가 'Button' 인터페이스를 잘못 구현합니다.
// 'onInit' 속성이 'Y9Button' 형식에 없습니다.
}실습
참고
Last updated
