我现在有一个需求
interface IGun {
(putBullet: number):void;
shot():void;
}class Gun implements IGun { bulletCount: number = 0;
construtor(putBullet: number) { this.bulletCount = putBullet;
}
shot() { // shotting bullet in boundary of bulletCount;
}
}interface IGun { constructor(putBullet: number):void;
shot():void;
}// 请把代码文本粘贴到下方(请勿用图片代替代码)
这两种定义interface都是错的,我想知道要怎么定义才正确呢?
I need help! please!!!
相关分类