ts重点学习72-implement语句
2023-05-18 07:00:17 阅读次数:77
ts
export default {}
interface IPersonInfo {
name: string;
age: number;
sex?: string;
show(): void;
}
interface IMusic {
music: string
}
class Person implements IPersonInfo {
name: string = "吴谨言";
age: number = 32;
music: string = "雪落下的声音";
show(): void {
console.log(`是延禧攻略的主演,她今年岁了`);
console.log(`唱了一首歌叫`);
}
}
let p = new Person();
p.show();
// p.name = "周冬雨";
// p.sex = "女";
interface ITest extends Person {
salary: number;
}
class Star extends Person implements ITest {
salary: number = 50;
name: string = "关晓彤";
age: number = 18;
}
let s = new Star();
console.log(s.salary);
console.log(s.name);
版权声明:本文内容来自第三方投稿或授权转载,原文地址:https://blog.51cto.com/u_15460007/6052311,作者:前端导师歌谣,版权归原作者所有。本网站转在其作品的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如因作品内容、版权等问题需要同本网站联系,请发邮件至ctyunbbs@chinatelecom.cn沟通。
上一篇:如何在Linux单用户模式下修改fstab文件
下一篇:hdoj 3555 BOMB(数位dp)