Creating a "permanent" Cocoa object

Posted by quixoto on Stack Overflow See other posts from Stack Overflow or by quixoto
Published on 2010-05-14T03:23:19Z Indexed on 2010/05/14 3:34 UTC
Read the original article Hit count: 256

I have an object factory that hands out instances of certain "constant" objects. I'd like these objects to be protected against bad memory management by clients. This is how I've overridden the class's key methods. Am I missing anything (code or other considerations)?

- (id)retain
{
    return self;
}

- (NSUInteger)retainCount
{
    return UINT_MAX;
}

- (void)release
{
    // nothing.
}

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa