Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
package com.brs
object ScalaCleverOverrideTraitExample extends App {
val myExample = new MyExample with TraitOne with TraitTwo ;
myExample.writeOut();
}
trait BaseTrait {
def writeOut()
}
trait TraitOne extends scala.BaseTrait {
override def writeOut() = {
println("In TraitOne")
}
}
trait TraitTwo extends scala.BaseTrait {
override def writeOut() = {
println("In TraitTwo")
}
}
class MyExample{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment