Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
object App {
def main(args: Array[String]): Unit = {
val b = new B {}
b.foo(1)
b.foo(-1)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
trait A {
def foo(a: Int) = println(s"A.foo $a")
}
trait B extends A
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
trait A {
def foo(a: Int) = println(s"A.foo $a")
}
trait AA extends A {
override def foo(a: Int) = {
if (a > 0) {
println(s"AA.foo $a")
} else {
super.foo(a)
}
}
}
trait B extends AA