Created
September 3, 2012 16:00
-
-
Save bjornharrtell/3610278 to your computer and use it in GitHub Desktop.
inherits twice?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseElement { | |
def foo() { println("I like foo") } | |
} | |
class SubElement extends BaseElement { | |
def bar() { println("I like bar") } | |
} | |
trait Base[T <: BaseElement] { | |
var map = Map[Int, T]() | |
} | |
trait OtherBase[T <: BaseElement] extends Base[T] { | |
map.get(0).get.foo(); | |
map = map -- map.keys.filter(_>0) | |
} | |
trait SubBase extends OtherBase[SubElement] { | |
var test = 0 | |
} | |
class Sub extends Base[SubElement] with SubBase { | |
map.get(0).get.bar(); | |
} | |
// Class Sub inherits Base twice?! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment