【基础】接口的理解

interface ClockInterface {
    new (hour: number, minute: number): ClockInterface;
}

class MyArray1 <M>{
    val: M;
    set(num: M){
        this.val = num;
    }
    get(){
       return this.val;
    }
}

var num = 1234;
var arr = '2222';

let a1 = new MyArray1<number>();
a1.set(num);

let a2 = new MyArray1<string>();
a2.set(arr);

let aa = a1.get();
aa.toFixed(2)
a2.get().toLocaleUpperCase();

 

posted @ 2017-05-07 21:30  五艺  阅读(178)  评论(0编辑  收藏  举报