ts类接口约束定义
(()=>{
 //类接口约束定义
 interface IPerson{
    //定义一个方法
    eat()
 }
 interface ISuper{
    //定义一个方法
    fly()
 }
 //定义实现接口的类,可以实现多个接口,用逗号区分
 class Person implements IPerson,ISuper{
    eat() {
        console.log('777777')
    }
    fly() {
        console.log('我是超人,我会飞')
    }
 }
 //初始化类
const p=new Person()
p.eat()
p.fly()
})()
 
                    
                     
                    
                 
                    
                
 
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号