泛型:
参数化的类型,一般用来限制结合的内容
class Student { constructor(public name: string) { } say() { console.log(this.name + " saying"); } } class HighSchoolStudent extends Student { constructor(name: string, no: string) { super(name) } no:string; study() { super.say(); } } var students: Array<Student> = []; students[0] = new Student("zhangsan"); students[1] = new HighSchoolStudent("lisi","06169010");
泛型 var students: Array<Student> = []; 用来定义数组只用是Student元素
作者:Work Hard Work Smart
出处:http://www.cnblogs.com/linlf03/
欢迎任何形式的转载,未经作者同意,请保留此段声明!