TS类的使用

自定义类:

export default class A{
    public name:string;
    public getString(){
         return this.name;
    }
    constructor(name:string){
        this.name=name;
    }
}

import A from "./~" //路径
class B{
     let a:A=new ();
     a.getString();
}

 



posted @ 2018-09-26 16:34  游戏鼻祖  阅读(309)  评论(0编辑  收藏  举报