Is "A with B" a type?

Viewed 147

In Scala we use mix-in like this:

class C extends A with B

I understand this declaration as C is a subclass of A with B. Is this true? Or C is just subclass of both A and B(I don't think it's possible on JVM which doesn't support multi-inheritance)?

If A with B is a type, why doesn't this line work?

classOf[A with B]

Another reason why I consider A with B a type is the fact that it can be used in pattern match:

val c = new C
val u = c match { case a: A with B => 1 } // 1
2 Answers
Related