泛型:
参数化的类型,一般用来限制结合的内容
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元素