Can a Scala class extend multiple classes?

You can’t extend multiple classes, but you can extend several traits. Unlike Java interfaces, traits can also include implementation (method definitions, data members, etc.). There is still a difference in that you can’t instantiate a trait directly (similar to abstract classes in a way).

trait T1
trait T2
trait T3
class C extends T1 with T2 with T3

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)