在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
class People { static _name: string; print() { //alert(this.name);// 编译不通过,doex not exist on type People;声明为static的变量通过类名调用 return(People._name) } constructor(name){ People._name = name; } } // let h = new People(); // // h.name = "aaa"; // People._name = "aaaa"; // h.print(); //创建类型,为当前类的类型(引用数据类型) let p:People; p = new People("aa"); alert(p.print())
|
请发表评论