Adding a custom initWith?

Viewed 51233

If I create a custom initWith for an object do I essentially include the code I would add should I want to override init?

-(id) init {
    self = [super init];
    if (self) {
        NSLog(@"_init: %@", self);
    }
    return(self);
}

e.g.

-(id) initWithX:(int) inPosX andY:(int) inPosY {
    self = [super init];
    if(self) {
        NSLog(@"_init: %@", self);
        posX = inPosX;
        posY = inPosY;
    }
    return(self);
}

gary

5 Answers
Related