Article View: comp.sys.next.programmer
Article #779Re: Multiple init: functions defined
From: Andrew Loewenstern
Date: Fri, 04 Sep 1992 22:24
Date: Fri, 04 Sep 1992 22:24
26 lines
1536 bytes
1536 bytes
In article <3575@richsun.cpg.trs.reuter.com> jack@richsun.cpg.trs.reuter.com (Jack Gidding) writes:
>
>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'
This is because you have init: defined differently in two places. In
RP, you have init:(int)pSize while in RS you have init:(id)sender.
This is a nono. If you need an initializer that takes an int for the
starting size, call it - initSize:(int)pSize, etc... and call that.
Don't forget to call [super init]...
andrew
--
andrew@cubetech.com | "We shall not cease from exploration
Andrew Loewenstern | And the end of our exploring
Cube Technologies, Inc. | Will be to arrive where we started
| And know the place for the first time." -T.S. Eliot
Technical Details
Message-ID:
<1992Sep4.222419.15820@cubetech.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!rpi!psinntp!psinntp!cubetech.com!imladris!andrewReferences:
<3575@richsun.cpg.trs.reuter.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!usc!rpi!psinntp!psinntp!cubetech.com!imladris!andrew From: andrew@cubetech.com (Andrew Loewenstern) Subject: Re: Multiple init: functions defined Message-ID: <1992Sep4.222419.15820@cubetech.com> Organization: Cube Technologies, Inc. References: <3575@richsun.cpg.trs.reuter.com> Date: Fri, 4 Sep 1992 22:24:19 GMT Lines: 26