In Objective C, why use `self == [className self]` in a class +initialize? -
this question has answer here:
i've seen in example-- in class initialize, line have purpose?
+(void)initialize { if (self == [toolcontroller self]) { ... } }
i have read in class method, self refers class , not object. in theory, wouldn't check result in true?
in mind, line resolve this: toolcontroller == toolcontroller
so that's why think result in true. missing something?
i think missing possibility self
subclass of toolcontroller.
presumably in example you're reading, whatever happening in +[toolcontroller initialize]
should happen when superclass (toolcontroller
) initializes, , not happen additionally when subclasses of toolcontroller
initialize.
Comments
Post a Comment