trait A[T <: A[T]]
trait B[T <: A[T]] extends A[T] {
def name: String
}
trait C[T <: B[_]] {
def doSomething(p: T) {
println(
p.name)
}
def anotherB(b: B[_]) = {
b.name }
}
class AC extends A[AC]
class BC extends AC with B[AC] {
def name = "Frog"
}
class BC2 extends AC with B[AC] {
def name = "BC2"
}
class CC extends C[BC] {
}
val cc = new CC
val bc = new BC
val bc2 = new BC2
println(cc.anotherB(bc2))
On Sun, Jul 5, 2009 at 9:12 PM, Naftoli Gugenhem
<naftoligug@...> wrote:
Sorry, I didn't ask the question right. I need an instance of C that can handle any instance of any subclass of B.
-------------------------------------
--
Lift, the simply functional web framework
http://liftweb.netBeginning Scala
http://www.apress.com/book/view/1430219890
Follow me:
http://twitter.com/dppGit some:
http://github.com/dpp