Last active
September 15, 2019 15:35
-
-
Save oliveiradev/1008413f032fe81531504539fa8280f1 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
interface Motor { | |
val cilindrada: Long | |
fun ligar() | |
} | |
class Motor1000 : Motor { | |
override val cilindrada: Long = 1000L | |
override fun ligar() { | |
print("vruum") | |
} | |
} | |
class Motor2000 : Motor { | |
override val cilindrada: Long = 2000L | |
override fun ligar() { | |
print("vruuuuum") | |
} | |
} | |
class Carro(val motor: Motor) { | |
fun darPartida() { | |
motor.ligar() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment