Skip to content

Instantly share code, notes, and snippets.

@tyrcho
Created March 14, 2013 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyrcho/5161680 to your computer and use it in GitHub Desktop.
Save tyrcho/5161680 to your computer and use it in GitHub Desktop.
abstract class Animal {
def greetings {
println("an animal")
}
}
trait Mammal extends Animal {
abstract override def greetings {
println("I'€™m a mammal")
super.greetings
}
}
trait Carnivore extends Mammal {
abstract override def greetings {
println("I'€™m a carnivore")
super.greetings
}
}
trait FourLegged extends Animal {
abstract override def greetings {
println("I have four legs")
super.greetings
}
}
object Dog extends Carnivore with FourLegged {
override def greetings {
println("I'€™m a dog")
super.greetings
}
}
Dog.greetings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment