Created
March 24, 2018 08:18
-
-
Save reddioment/41dc4cd0fb4d98c5094c82802e7924a9 to your computer and use it in GitHub Desktop.
init-class-subclass-override
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 SomeClass { | |
var str: String | |
init(str: String) { | |
self.str = str | |
} | |
convenience init(strFromInt num: Int) { | |
self.init(str: "\(num)") | |
} | |
} | |
class AnotherClass: SomeClass { | |
var text: String | |
init(text: String, str: String) { | |
self.text = text | |
super.init(str: str) | |
} | |
convenience override init(str: String) { | |
self.init(text: "", str: str) | |
} | |
convenience init(strFromInt num: Int) { | |
self.init(str: "\(num)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment