Created
October 24, 2016 10:54
-
-
Save RichoDemus/a2134159ddc51b976582e5f23ed63ca2 to your computer and use it in GitHub Desktop.
Kotlin initialize member variables in constructor
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 UsingPrimaryConstructorAndInit(val constructor_parameter: String) { | |
private val initialized_by_class: String | |
init { | |
this.initialized_by_class = "asdasd" | |
} | |
} | |
class UsingSecondaryConstructor { | |
private val constructor_parameter: String | |
private val initialized_by_class: String | |
constructor(param:String) { | |
this.constructor_parameter = param | |
this.initialized_by_class = "asdasd" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment