views:

282

answers:

1

I have a protocol in objective-c, something like this:

@protocol Handler
+(NSString*) getValue;
@end

So now say I have an instance that inherits this protocol and I want to call this method:

[handlerInstance getValue];

This give a warning because the getValue method is not an instance method. How can I properly call this method from my instance? (Without knowing the concreate class)? I'm guessing something like this, but im not exactly sure:

[[handlerInstance class] getValue];
+1  A: 
[[handlerInstance class] getValue];

Yes, like this.

Unlike Java and C++, class methods can only be sent to the class.

KennyTM
Seriously, I guess I shouldn't have second guessed myself!
Zenox
Trying it out before posting is less work, too — for all of us. :-)
Quinn Taylor