
16 2. The Basics—How Does It All Work?
memory), we can play it safe and check again in the init method whether the reference
*
in fact exists:
if (self) {
//everything is OK
} else {
//error: self = nil
}
Here, nil means that the object is not present and therefore has the truth value
false (note that nil is not the same as NULL and thus can be used as a valid parameter).
e return value of self (= our object reference) is id; an id is a typeless object—a wild
card for objects, so to speak. Since we are creating the object with
MyObject *myObject = [[MyObject alloc] init];
we shall make a typed object of type MyObject out of the typeless id object ...