discuss-gnustep
[Top][All Lists]
Advanced

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

Weird behaviour


From: Gerrit Van Dyk
Subject: Weird behaviour
Date: Tue, 7 Aug 2001 09:19:05 +0200

Hi all,

If I define a class 

@interface MyNotificationCenter : NSObject
{
}

+ (MyNotificationCenter *)defaultCenter;

@end

and I call this method from code

x = [MyNotificationCenter defaultCenter];

the compiler complains about a duplicate definition of defaultCenter, the
first is in NSNotificationCenter and the second in MyNotificationCenter.
This is understandable because it is defined in 2 places. What I don't
understand, is why the compiler complains about the duplicate definition as
my call is directed at MyNotificationCenter and not to a generic Class. On
Openstep4.2, and previous versions at least till 3.2, this behaviour does
not exist. If this is the behaviour on Class methods then where does
polymorphism get into the equation on class methods.

I also expect that this is the reason why +(NSMutableDictionary *)dictionary
is not implemented on NSMutableDictionary, I have to typecast all my calls
to [NSMutableDictionary dictionary] to a NSMutableDictionary because the
method is only implemented on NSDictionary.

Is there a compiler option to switch this behaviour off or what am I doing
wrong? It just does not make sense. 

I am using the egcs-compat compiler that came with redhat 7.1.

Regards
Gerrit van Dyk
 
-------------------------------------------------------------------------
This e-mail is intended only for the of the individual or entity named above
and may contain information that is confidential and privileged, proprietary
to the company and protected by law. If you are not the intended recipient,
you are hereby notified that any dissemination, distribution or copying of
this e-mail is strictly prohibited. Opinions, conclusions and other
information in this message that do not relate to the official business of
our company shall be understood as neither given nor endorsed by it.



reply via email to

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