-(void) setOrigin: (XYPoint *) pt
{
if (! origin)
origin = [[XYPoint alloc] init];
origin.x = pt.x;
origin.y = pt.y;
}
The book states on page 167, "If the origin is zero, the setOrigin: method will allocate and initialize a new XYPoint object and store the reference to it in the origin." If origin is zero then it is not pointing to anything and why perform an allocation of origin if it is zero. Should it not read as " If the origin is not zero" which means origin is already pointing to a value and a new instance of this object needs to be allocated. Am I reading this wrong?