Olá António

I think your method must be corrected like this:


On 2009/01/25, at 07:28, cocoa-dev-requ...@lists.apple.com wrote:

@implementation PDFDocument (PDFDocument_Alloc)

+ (id)replacementAllocWithZone:(NSZone *)zone
{
        if ([self class] == [PDFDocument class]) {
                return [ANPDFDocument replacementAllocWithZone:zone];
        } else {
                return [super allocWithZone:zone];
        }
}


Note that you have to invoke the class method of self in order to compare it properly. Otherwise you are comparing a pointer to a class and the class name, which is the same as comparing apples with oranges. For further information read the introspection chapter in the Cocoa Fundamentals Guide:

http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_7.html

HTH

Joao Varela

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to