0
点赞
收藏
分享

微信扫一扫

ts重点学习65-类的继承笔记

爱我中华8898 2022-10-02 阅读 181

export default {}


// static
class StaticTest {
static salary: string;
static say():void {
console.log("我们想要的工资是: " + this.salary);
}
}

StaticTest.salary = "18k";
StaticTest.say();

// instanceof
class Person {}
let p = new Person();
let isPerson = p instanceof Person;
console.log("p对象是Person类实例化来的嘛?" + isPerson);

class Student extends Person {}
let s = new Student();
let isPerson2 = s instanceof Person;
console.log("p对象是Person类实例化来的嘛?" + isPerson2



举报

相关推荐

0 条评论