当前位置:网站首页>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()
}
}
边栏推荐
- Mobile security tool -dex2jar
- 2022年全国最新消防设施操作员(高级消防设施操作员)模拟题及答案
- 移动安全工具-jarsigner
- Uniapp encapsulated incentive advertisement, screen insert advertisement and banner advertisement
- QT(35)-操作EXCEL-QXlsx-QAxObject
- 【微服务|Sentinel】Sentinel快速入门|构建镜像|启动控制台
- Hot fix sophix multi-channel patch solution
- Android SQLite database
- Use of JMeter
- Applet opening traffic master
猜你喜欢
A small program written this week
2022 melting welding and thermal cutting recurrent training question bank simulated examination platform operation
The acceleration of 100 km is only 5.92 seconds, and the willanda high-performance version leads with the strength of high-energy products
WordPress add photo album function [advanced custom fields Pro custom fields plug-in series tutorial]
移动安全工具-jar
Technologie des fenêtres coulissantes en octets dans la couche de transmission
Use of JMeter easynmon
最新QQ微信域名防红PHP程序源码+强制跳转打开
Use of navigation and navigationui
打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?
随机推荐
C# 闭包的垃圾回收
【微服务|Sentinel】簇点链路|微服务集群环境搭建
Xcode预览(Preview)显示List视图内容的一个Bug及解决
Text editor for QT project practice - Episode 12
Previous basic review
Go crawler framework -colly actual combat (I)
Tiktok wallpaper applet source code
EVM Brief
2021-02-15
Text editor of QT project practice ---------- episode 11
Tiktok wallpaper applet, starlight wallpaper applet version 2.0, upgraded version
Several ways for wechat applet to jump to the page are worth collecting
Redis + Lua implementation of distributed interface current limiting
ros(25):rqt_image_view报错Unable to load plugin for transport ‘compressed‘, error string
断言(assert)的用法
The basic principle and application of iterator and enhanced for
2021-04-18
智能合约安全审计入门篇 —— delegatecall (2)
Scrollview height cannot fill full screen
Tiktok wallpaper applet v1.0.2 function, new arrival function