当前位置:网站首页>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()
}
}
边栏推荐
- 断言(assert)的用法
- Eliminate duplicate dependencies
- A small crawler program written by beginners
- Text editor of QT project practice ---------- episode 11
- Usage of assert
- QT(35)-操作EXCEL-QXlsx-QAxObject
- 打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?
- QT (35) - operate excel qxlsx qaxobject
- Xcode预览(Preview)显示List视图内容的一个Bug及解决
- 热力图展示相关矩阵
猜你喜欢

打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?

Databinding quick start (still using findviewbyid?)

Simulation questions and answers of the latest national fire facility operator (senior fire facility operator) in 2022

移动安全工具-jar

ros(24):error: invalid initialization of reference of type ‘xx’ from expression of type ‘xx’

Text editor of QT project practice ---------- episode 11

Punch smart spirit 1. The brand is attractive. What is the strength of the product?
WordPress add photo album function [advanced custom fields Pro custom fields plug-in series tutorial]

Tiktok wallpaper applet v1.0.2 function, new arrival function
[distributed system design profile (2)] kV raft
随机推荐
Leetcode 1248. Statistics of "graceful subarray" (harm, suddenly found that it can only enumerate violently)
Simple collation of Web cache
Garbage collection of C closure
Use coordinatorlayout+appbarlayout+collapsingtoolbarlayout to create a collapsed status bar
Source code analysis the problem that fragments cannot be displayed in the custom ViewGroup
Kubernetes 架构核心组件工作原理解析
Text editor for QT project practice -- Episode 9
ros(25):rqt_ image_ View reports an error unable to load plugin for transport 'compressed', error string
Some examples of MgO operating database in go
移动安全工具-apktool
Apk slimming compression experience
Only positive integers can be entered in the text box
ros(25):rqt_image_view报错Unable to load plugin for transport ‘compressed‘, error string
QT(36)-rapidjson解析嵌套的json
ServerSocket and socket connection
Network request -volley
Easy to wear - drop down radio
Input series
Use of JMeter
108页(4万字)未来公寓智能化设计平台项目方案建议书2022版