Last active
April 8, 2018 03:56
-
-
Save mahesh2492/912fa3da297660afc96c657815610e2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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