objective c - iphone how to specify the Class data type have to adopt to a protocol -


In my application, I will have to return "class" as return type:

.m:

  + (Class) getParserClass {Return to [NCCRCparcer Class]; }  

NCCurrencyParser.m:

  @interface NCCurrencyParser NSObject & lt; NCParser & gt; @protocol NCParser + (NSNumber *) Parser number: (NSN * *) Number; In the caller mode,  

:

  class parserClass = [application getParserClass]; [Parser class parser number: 1.0];  

But then the compiler gives me an error that parserClass can not respond to parseNumber. How do I classify some protocols like: class & lt; Ncparser & gt;

Strong> first class objects, and any other objective-object such as protocol can apply. (ID, NSOBEX *, ...)

Just do whatever you want Generally, for any other object protocols, i.e.:

  + (class ) GetParserClass {Return (NCCRs) Student class];}  

and

  class  ParserClass = [application getParserClass]; [Parser class parser number: 1.0];  

Created / compiled / tested on xcode 3.2.3, iPhone Simulator 4.0, GCC 4.2


Comments