[Biococoa-dev] Base test

Alexander Griekspoor mek at mekentosj.com
Fri Aug 13 15:26:24 EDT 2004


Allright! I don't get it why it didn't work in my example as I did  
exactly the same !?! Anyway, it works in my example now as well.
Guess that's the solution we need John.....
Thanks Jim!



Op 13-aug-04 om 21:22 heeft Jim Balhoff het volgende geschreven:

> On Aug 13, 2004, at 3:15 PM, Alexander Griekspoor wrote:
>
>>> A classes are objects, it seems like it would work.
>>
>> I'm not so sure about that, but probably you are right. Anyway, the  
>> description says:
>>
>> objc_msgSend
>>
>> Sends a message with a simple return value to an instance of a class.
>>
>> So I'm afraid it doesn't work on the class itself. I couldn't get it  
>> to work either, but perhaps I'm doing something else wrong here...
>>
>>
>
> It works, try this:
>
> ******************************************main.m*********************** 
> *********
> #import <Foundation/Foundation.h>
> #import "MyClass.h"
>
> int main (int argc, const char * argv[]) {
>     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>     SEL message = NSSelectorFromString(@"giveMeAnA");
>     NSString *result = objc_msgSend([MyClass class], message);
>     NSLog(result);
>     [pool release];
>     return 0;
> }
> ******************************************main.m*********************** 
> *********
>
> ******************************************MyClass.h******************** 
> ************
> #import <Foundation/Foundation.h>
>
>
> @interface MyClass : NSObject {
>
> }
>
> + (NSString *)giveMeAnA;
>
> @end
> ******************************************MyClass.h******************** 
> ************
>
> ******************************************MyClass.m******************** 
> ************
> #import "MyClass.h"
>
>
> @implementation MyClass
>
> + (NSString *)giveMeAnA
> {
>     return @"A";
> }
>
> @end
> ******************************************MyClass.m******************** 
> ************
*********************************************************
                     ** Alexander Griekspoor **
*********************************************************
              The Netherlands Cancer Institute
              Department of Tumorbiology (H4)
         Plesmanlaan 121, 1066 CX, Amsterdam
                    Tel:  + 31 20 - 512 2023
                    Fax:  + 31 20 - 512 2029
                    AIM: mekentosj at mac.com
                    E-mail: a.griekspoor at nki.nl
                Web: http://www.mekentosj.com

       Microsoft is not the answer,
       Microsoft is the question,
       NO is the answer

*********************************************************




More information about the Biococoa-dev mailing list