Inicializador de conveniência rápida
class University {
var name : String
var rank : String
init(name : String, rank: String) {
self.name = name
self.rank = rank
}
// define convenience init
convenience init() {
self.init(name: "Kathmandu University", rank: "1st")
}
}
var university1 = University()
print(university1.name)
print("Rank:", university1.rank)
SAMER SAEID