Call of the parent class constructor in Swift
class Man {
var name: String
init (_ name: String) {
self.name = name
}
}
class Employee: Man {
var position: String
init(_ name: String, _ position: String) {
self.position = position
super.init(name)
}
}
let employee = Employee("Max", "booker")
- Log in to post comments