Pergunta

I inherited another developer code, but didn't understood the following code (Notice the ';' in the of first line):

-(id) initWithTarget:(id)target  AndAction:(void(*)(id target,id sender ,NSString* xml))action; {
    self = [super init];
    if (self) {
        [self setTargetAction:action];
        [self setActionDelegate:target];
    }
    return self; }

This code compiles fine without any warning \ error. Is it just looks to me, or this is a method declaration (which of course won't have any definition), and another block which couldn't be performed (without any method name) ???

Foi útil?

Solução

That semi-colon is simply ignored by the compiler. It's a convenience so that you can copy the method definition from the @interface into the @implementation and just get on with things. It makes no functional difference if it's there or not.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top