Skip to content

Instantly share code, notes, and snippets.

@bjornharrtell
Created September 3, 2012 16:00
Show Gist options
  • Save bjornharrtell/3610278 to your computer and use it in GitHub Desktop.
Save bjornharrtell/3610278 to your computer and use it in GitHub Desktop.
inherits twice?
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