当前位置:网站首页>Scala classes inherit multiple attributes
Scala classes inherit multiple attributes
2022-06-25 01:03:00 【Jue Niu thunder plough hot blade】
object Class inherits multiple traits {
trait MessageSender {
def send(msg: String): Unit
}
trait MessageReceiver {
def receive(): Unit
}
class MessageWorker extends MessageSender with MessageReceiver {
override def send(msg: String): Unit = println(s" Send a message :${msg}")
override def receive(): Unit = println(" A message has been received ")
}
def main(args: Array[String]): Unit = {
val mv = new MessageWorker
mv.send(" Morse code ")
mv.receive()
}
}
边栏推荐
- VNC viewer remote connection raspberry pie without display
- C#和C 的CAN通信实验
- 不重要的token可以提前停止计算!英伟达提出自适应token的高效视觉Transformer网络A-ViT,提高模型的吞吐量!...
- C# 闭包的垃圾回收
- 【微服务|Sentinel】实时监控|RT|吞吐量|并发数|QPS
- Easy to wear - drop down radio
- Go语言运算符(第8课下)
- Text editor of QT project practice ---------- episode 11
- December 6, 2019 what happens after the browser enters a URL
- Thermodynamic diagram display correlation matrix
猜你喜欢
Xcode preview displays a bug in the content of the list view and its solution
Practical operation notes - notebook plus memory and ash cleaning
不重要的token可以提前停止计算!英伟达提出自适应token的高效视觉Transformer网络A-ViT,提高模型的吞吐量!...
移动安全工具-jar
2022年全国最新消防设施操作员(高级消防设施操作员)模拟题及答案
Using tcp/udp tools to debug the yeelight ribbon
【微服务|Sentinel】Sentinel快速入门|构建镜像|启动控制台
Paper review: U2 net, u-net composed of u-net
2022熔化焊接与热切割复训题库模拟考试平台操作
@mysql
随机推荐
Redis + Lua implementation of distributed interface current limiting
Xcode preview displays a bug in the content of the list view and its solution
2022熔化焊接与热切割复训题库模拟考试平台操作
Decoupling pages and components using lifecycle
Single blind box removal, social blind box and friend blind box program source code
Go语言运算符(第8课下)
[Solved] Public key for mysql-community-xxx. rpm is not installed
VNC viewer remote connection raspberry pie without display
Examination questions and mock examination for safety management personnel of hazardous chemical business units in 2022
传输层 以字节为单位的滑动窗口技术
Paint rounded rectangle
【微服务|Sentinel】簇点链路|微服务集群环境搭建
Previous basic review
Use and click of multitypeadapter in recycleview
108页(4万字)未来公寓智能化设计平台项目方案建议书2022版
Easy to wear - drop down radio
Jar package merging using Apache ant
JS dynamically generates variable names and assigns values
2022安全员-C证考试模拟100题及在线模拟考试
adb shell sendevent