File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
scala3-lang-2/src/main/scala/com/baeldung/scala3/transparent Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ This module contains articles about the Akka library in Scala.
13
13
- [ Typed Mailboxes in Scala] ( https://www.baeldung.com/scala/typed-mailboxes )
14
14
- [ Discovering Actors in Akka] ( https://www.baeldung.com/scala/discovering-actors-in-akka )
15
15
- [ Different Ways to Stop Akka Actors] ( https://www.baeldung.com/scala/stop-akka-actors )
16
- - [ Reading an Akka Response Body as a String] ( https://www.baeldung.com/scala/akka-response-body-to-string )
16
+ - [ Reading an Akka-HTTP Response Body as a String] ( https://www.baeldung.com/scala/akka-response-body-to-string )
Original file line number Diff line number Diff line change
1
+ package com .baeldung .scala3 .transparent
2
+
3
+ object NonTransparent {
4
+ trait Marker
5
+ trait Genre {
6
+ def name : String
7
+ }
8
+ object Horror extends Genre , Marker {
9
+ override val name : String = " Horror"
10
+ }
11
+ object Comedy extends Genre , Marker {
12
+ override val name : String = " Comedy"
13
+ }
14
+ val isScary = true
15
+ val genre /* : Genre & Marker*/ = if (isScary) Horror else Comedy
16
+ }
17
+
18
+ object Transparent {
19
+ transparent trait Marker
20
+ trait Genre {
21
+ def name : String
22
+ }
23
+ object Horror extends Genre , Marker {
24
+ override val name : String = " Horror"
25
+ }
26
+ object Comedy extends Genre , Marker {
27
+ override val name : String = " Comedy"
28
+ }
29
+ val isScary = true
30
+ val genre /* : Genre*/ = if (isScary) Horror else Comedy
31
+ }
You can’t perform that action at this time.
0 commit comments