■
$ scala ... scala> trait X { def run } defined trait X scala> var x: X = null x: X = null scala> class Person extends X { | def run = println("two legs") | } defined class Person scala> class Dog extends X { | def run = println("four legs") | } defined class Dog scala> class Car extends X { | def run = println("wheel tracks") | } defined class Car scala> class Computer extends X { | def run = println("move about") | } defined class Computer