Skip to content

Instantly share code, notes, and snippets.

@dvliman
Created November 21, 2013 20:16
Show Gist options
  • Save dvliman/7588845 to your computer and use it in GitHub Desktop.
Save dvliman/7588845 to your computer and use it in GitHub Desktop.
we can put object inside a trait in Scala
object Dog {
def bark {
println("barking")
}
}
trait Animal {
object Cat {
def meow {
println("meowing")
}
}
}
object AnimalLike extends Animal {}
object Main {
def main(args: Array[String]) {
Dog.bark
AnimalLike.Cat.meow
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment