I have the following class, with an init method:
class user {
var name:String
var address:String
init(nm: String, ad: String) {
name = nm
address = ad
}
}
I'm trying to subclass this class but I keep getting errors on the super.init()
part:
class registeredUser : user {
var numberPriorVisits: Int
// This is where things start to go wrong - as soon as I type 'init' it
// wants to autocomplete it for me with all of the superclass' arguments,
// and I'm not sure if those should go in there or not:
init(nm: String, ad: String) {
// And here I get errors:
super.init(nm: String, ad: String)
// etc....
Apple's iBook has examples of subclassing, but none those feature classes that have an init()
method with any actual arguments in it. All their init's are devoid of arguments.
So, how do you do this?