当前位置:网站首页>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()
}
}
边栏推荐
- 2022年危险化学品经营单位安全管理人员考试试题及模拟考试
- EVM简略
- 最新QQ微信域名防红PHP程序源码+强制跳转打开
- The acceleration of 100 km is only 5.92 seconds, and the willanda high-performance version leads with the strength of high-energy products
- Go crawler framework -colly actual combat (II) -- Douban top250 crawling
- ros(25):rqt_image_view报错Unable to load plugin for transport ‘compressed‘, error string
- Eliminate duplicate dependencies
- Text editor for QT project practice - Episode 10
- Leetcode 1248. Statistics of "graceful subarray" (harm, suddenly found that it can only enumerate violently)
- 智能合约安全审计入门篇 —— delegatecall (2)
猜你喜欢

Single blind box removal, social blind box and friend blind box program source code

移动安全工具-jar

Sliding window technology based on byte in transport layer

ServerSocket and socket connection

2019 summary and 2020 outlook

不重要的token可以提前停止计算!英伟达提出自适应token的高效视觉Transformer网络A-ViT,提高模型的吞吐量!...

Text editor for QT project practice - Episode 10

2022r1 quick opening pressure vessel operation test questions and answers

Punch smart spirit 1. The brand is attractive. What is the strength of the product?

A small program written this week
随机推荐
Source code analysis the problem that fragments cannot be displayed in the custom ViewGroup
Thermodynamic diagram display correlation matrix
2021-02-15
Mobile security tool apktool
Decoupling pages and components using lifecycle
Tiktok wallpaper applet v1.0.2 function, new arrival function
Android SQLite database
How to use promise Race() and promise any() ?
51单片机多机通信
Simulation questions and answers of the latest national fire facility operator (senior fire facility operator) in 2022
Infotnews | is the development of domestic NFT limited to digital collections?
Text editor for QT project practice - Episode 10
The drawableleft of the custom textview in kotlin is displayed in the center together with the text
A website for programmers with a monthly salary of 30K
ServerSocket and socket connection
The basic principle and application of iterator and enhanced for
移动安全工具-jar
redis + lua实现分布式接口限流实现方案
Simple collation of Web cache
[redis realizes seckill business ③] specific implementation of optimistic lock for oversold problem