Created
August 2, 2017 21:46
-
-
Save 10537/2e586e7d2a94a3b695bf71469e585b10 to your computer and use it in GitHub Desktop.
Become a Kotlin Programmer Part 6 - Override a method and the super keyword
This file contains hidden or 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
class Human(name: String, val color: String, | |
val height: Double, var age: Int): Character(name) { | |
var head_armor = false | |
var body_armor = false | |
var boots_armor = false | |
var weapon = false | |
override fun Run(){ | |
super<Character>.Run() | |
println("Running in beast mode...") | |
} | |
fun set_head_armor(){ | |
head_armor = true | |
} | |
fun set_body_armor(){ | |
body_armor = true | |
} | |
fun set_boots_armor(){ | |
boots_armor = true | |
} | |
fun set_weapon(){ | |
weapon = true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment