home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.next.programmer
- Path: sparky!uunet!das.wang.com!wang!news
- From: izeek@techunix.technion.ac.il (Ilan Aisic)
- Subject: Re: Multiple init: functions defined
- Reply-To: izeek@techunix.technion.ac.il (Ilan Aisic)
- Organization: Technion, Israel Inst. of Technology
- Date: Thu, 3 Sep 1992 05:32:07 GMT
- Message-ID: <1992Sep3.053207.26459@discus.technion.ac.il>
- References: <3575@richsun.cpg.trs.reuter.com>
- Sender: news@wang.com
- Lines: 46
-
- 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 just a warning to alert you that these are 2 different methods that
- have the same name "- init:" but not the same parameter definition.
- C++ would have treated this as 2 really different member functions that
- cannot override each other. In Objective-C, you many have situations
- where you wouldn't know what is the exact kind of object that you're
- dealing with and then you wouldn't be sure what kind of parameter the
- method -init: (which is may be implemented in many of your classes)
- should take.
- For example: you have an OrdCltn called "ordCltn" where you mix objects
- of classes RP and RS and you want to init: all it's members.
- Since init: receives different parameter in RP and RS, you would
- not be able to use the line:
- [ordCltn elementsPerform: @selector(init:) with: yourValue];
-
- Anyway, it's only a warnning.
-
-
-
- ____
- / / __
- / / /_/ /| /
- __/_ /__ / / / |/ o o o
-
- Ilan Aisic
- Israel USA
- Voice: 972-4-344474 1-914-644-7710
- Fax: 972-4-342492 1-914-644-7763
- E-mail: izeek@techunix.technion.ac.il ilan@allink.com
- --
-
- ____
- / / __
- / / /_/ /| /
-