接口的理解
Posted 五艺
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了接口的理解相关的知识,希望对你有一定的参考价值。
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();
以上是关于接口的理解的主要内容,如果未能解决你的问题,请参考以下文章
调用模板化成员函数:帮助我理解另一个 *** 帖子中的代码片段