// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
trait X {
  def hi(): Unit = {
    println("Hi")
  }
}

trait Y {
  def hello(): Unit = {
    println("Hello")
  }
}

class A {
}

class AA extends A with X with Y {
}

class B {
}

class BB extends B with X with Y {
}

def f(o: X&Y): Unit = {
  o.hi()
  o.hello()
}

object Ext30 {
  def main(args: Array[String]): Unit = {
    f(new AA())
    f(new BB())
    f(new A() with X with Y)
    f(new B() with X with Y)
  }
}
