Skip to content

Instantly share code, notes, and snippets.

@dwhitney
Created June 23, 2010 16:21
Show Gist options
  • Save dwhitney/450156 to your computer and use it in GitHub Desktop.
Save dwhitney/450156 to your computer and use it in GitHub Desktop.
trait Foo{
val id: String
}
trait SubFoo extends Foo{
val id = "1234"
}
abstract class Bar{
def save[T <: Foo](foo: T): Unit
}
class BarImpl extends Bar{
def save(foo: SubFoo) = println(foo.id)
}
object Tmp extends Application{
object Foop extends SubFoo
val bar = new BarImpl
bar.save(Foop)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment