🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #1031

Multiple init: functions defined

#1031
From: Jack Gidding
Date: Wed, 02 Sep 1992 20:37
40 lines
1462 bytes
Hmmmm..... this is really strange and very undesired behavior from Objective-C.

When I include the header files from two different classes into a third class,  
and each of the included classes have a single init: method defined, I get  
messages similar to the following:


main2.m:18: warning: multiple declarations for method `init:'
/Clib/RP.h:32: using `-init:(int )pSize'
/Clib/RS.h:31: also found `-init:(OBJPTR )s'


Why is this happening??? Sometimes it tells me that it resolved which init to  
use, sometimes not, and sometimes it resolves it to the wrong init:.


The code that has the init method is sililar in form to:

	#import <RP.h>	// Both RP and RS have and init: method
	#import <RS.h>

	id x;

	x = [[RP alloc] init:(int) 5];

id is totally dynamic, and thus it really does not know which init to use....

So, why is it telling me that it is using one method or another...shouldn't  
this be left up until run-time? 


Am I doing something wrong to cause this?


Thanks,


Jack Gidding
jack@richsun.cpg.trs.reuter.com
Technical Details
Message-ID: <3575@richsun.cpg.trs.reuter.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!richsun!richsun.cpg.trs.reuter.com

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!richsun!richsun.cpg.trs.reuter.com
From: jack@richsun.cpg.trs.reuter.com (Jack Gidding)
Newsgroups: comp.sys.next.programmer,comp.lang.objective-c
Subject: Multiple init: functions defined
Message-ID: <3575@richsun.cpg.trs.reuter.com>
Date: 2 Sep 92 20:37:28 GMT
Sender: news@richsun.cpg.trs.reuter.com
Followup-To: comp.sys.next.programmer
Lines: 40