Skip to content

Instantly share code, notes, and snippets.

@mahesh2492
Last active April 8, 2018 03:56
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 mahesh2492/912fa3da297660afc96c657815610e2d to your computer and use it in GitHub Desktop.
Save mahesh2492/912fa3da297660afc96c657815610e2d to your computer and use it in GitHub Desktop.
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