discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem conformsToProtocol in class category


From: Martin Durkac
Subject: Problem conformsToProtocol in class category
Date: Mon, 01 Oct 2001 15:12:51 +0000

Hi,

I have found out the problem (or incompatibility with OPENSTEP 4.2)
in Foundation with method of NSObject conformsToProtocol.

The following simple program in OPENSTEP (4.2 Intel) 
print out "conforms OK", in GNUSTEP (0.7 - Solaris 2.8 Intel) 
"conforms ERR".

Is it a correct behaviour ???

#import <Foundation/Foundation.h>
#import <stdio.h>

@protocol MyProtocol

- (void) myProtoMethod: (id) aObj;

@end

@interface MyClass : NSObject 
{
}

@end

@implementation MyClass
@end

@interface MyClass (MyCategory) <MyProtocol>
@end

@implementation MyClass (MyCategory)

- (void) myProtoMethod: (id) aObj
{
}

@end

int main (int argc, const char *argv [])
{
    id myObj = [MyClass new];

    if ([myObj conformsToProtocol: @protocol (MyProtocol)])    
        printf ("conforms OK\n");
    else
        printf ("conforms ERR\n");

    return 0;
}

--
mato

Martin Durkac
mdurkac@pobox.sk




reply via email to

[Prev in Thread] Current Thread [Next in Thread]