当前位置:网站首页>typescript的class结合接口(interface)的简单使用
typescript的class结合接口(interface)的简单使用
2022-06-26 06:13:00 【前端一枚】
1、接口间继承extends
2、类结合接口使用implements
interface Radio{
switchRadio(trigger:boolean):void
}
interface Battery{
checkBatteryStatus():void
}
//接口继承extends
interface RadioWithBattery extends Radio{
checkBatteryStatus():void
}
//接口接合类implements
class Cellphone implements Radio{
switchRadio(trigger:boolean){}
}
//接口接合类implements
class Cellphone2 implements RadioWithBattery{
switchRadio(trigger:boolean){}
checkBatteryStatus(){}
} 边栏推荐
- Import export simple
- Record how to modify the control across threads
- 打印数字的位信息
- 工作积累——Web请求中使用ThreadLocal遇见的问题
- [intra group questions semester summary] some reference questions for beginners
- Unsatisfied dependency expressed through field ‘baseMapper‘; nested exceptio
- University Information Management System
- 成水最多的容器
- Keepalived to achieve high service availability
- Data visualization practice: Data Visualization
猜你喜欢
随机推荐
Mongodb——使用Mongodb对字段中字符串内容进行截取,并进行分组统计
Matching environment of ES6
numpy. frombuffer()
打印数字的位信息
Redis underlying data structure
实时数仓方案如何选型和构建
消息队列-全方位对比
Logstash -- send an alert message to the nail using the throttle filter
Level signal and differential signal
Playing RTSP streaming video on Web pages (webrtc)
How to select and build a real-time data warehouse scheme
Lamda expression
SQL Server view
Func < T, tresult > Commission - learning record
Vs2022 offline installation package download and activation
Gof23 - abstract factory pattern
Import export simple
Gof23 - factory mode
The interviewer with ByteDance threw me an interview question and said that if I could answer it, other companies would have an 80% chance of passing the technical level
Connexion et déconnexion TCP, détails du diagramme de migration de l'état








