類別與介面
類別實現介面
interface Alarm {
alert();
}
class Door {
}
class SecurityDoor extends Door implements Alarm {
alert() {
console.log('SecurityDoor alert');
}
}
class Car implements Alarm {
alert() {
console.log('Car alert');
}
}介面繼承介面
介面繼承類別
混合型別
參考
Last updated