Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reddioment/95256b5ace68506ed704c85c74e60ccd to your computer and use it in GitHub Desktop.
Save reddioment/95256b5ace68506ed704c85c74e60ccd to your computer and use it in GitHub Desktop.
init-class-subclass-overriding-designated,conveniance
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)
}
override init(str: String) {
self.text = str
super.init(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