Skip to content

Instantly share code, notes, and snippets.

@mahesh2492
Last active Apr 8, 2018
Embed
What would you like to do?
trait Animal{
def speak = println("speaking..")
def walk = println("walking fastly..")
def comeToMaster: Unit
}
class Cat extends Animal{
override def speak: Unit = println("meow....")
def comeToMaster = println("catch me if you can..")
}
object Sample extends App{
val kity = new Cat
kity.speak
kity.walk
kity.comeToMaster
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment