//定义一个人的接口interface Human {name: string;age: number;say(word: string): void;}//让老师类实现Human接口,老师类实现接口的时候必须提供接口的具体信息class Teacher implements Human{name = "老师";age = 38;say(word: string): void {console.log("老师说"+word)}}//让学生类实现Human接口,学生类实现接口的时候必须提供接口的具体信息class Student implements Human{name = "学生";age = 18;say(word: string): void {console.log("学生说"+word)}}
