Last active
January 27, 2018 07:34
-
-
Save abdurahmanadilovic/d4a7ee4d15bd95038d60a2916783b830 to your computer and use it in GitHub Desktop.
Kotlin multiple secondary constructors
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
class SecondaryConstructor(){ | |
constructor(aValue: Int) : this(){ | |
println("a second constructor") | |
} | |
constructor(aValue: Int, aSecondValue: Int) : this(aValue){ | |
println("a third constructor") | |
} | |
} | |
fun main(args: Array<String>) { | |
SecondaryConstructor(1,2) | |
} | |
// a second constructor | |
// a third constructor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment