Skip to content

Instantly share code, notes, and snippets.

@abdurahmanadilovic
Last active January 27, 2018 07:34
Show Gist options
  • Save abdurahmanadilovic/d4a7ee4d15bd95038d60a2916783b830 to your computer and use it in GitHub Desktop.
Save abdurahmanadilovic/d4a7ee4d15bd95038d60a2916783b830 to your computer and use it in GitHub Desktop.
Kotlin multiple secondary constructors
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