Skip to content

Instantly share code, notes, and snippets.

@skanev
Created December 4, 2010 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skanev/728317 to your computer and use it in GitHub Desktop.
Save skanev/728317 to your computer and use it in GitHub Desktop.
The epic fight between inheritance and type systems, in pseudo-Scala
class StrangeIntQue extends Queue[Int] {
override def append(x: Int) {
println(Math.sqrt(x))
super.append(x)
}
}
val x: Queue[Any] = new StrangeIntQueue
x.append("abc") // Math.sqrt("abc") ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment