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