home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / next / programm / 5946 < prev    next >
Encoding:
Text File  |  1992-09-02  |  2.2 KB  |  59 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!das.wang.com!wang!news
  3. From: izeek@techunix.technion.ac.il (Ilan Aisic)
  4. Subject: Re: Multiple init: functions defined
  5. Reply-To: izeek@techunix.technion.ac.il (Ilan Aisic)
  6. Organization: Technion, Israel Inst. of Technology
  7. Date: Thu, 3 Sep 1992 05:32:07 GMT
  8. Message-ID: <1992Sep3.053207.26459@discus.technion.ac.il>
  9. References: <3575@richsun.cpg.trs.reuter.com>
  10. Sender: news@wang.com
  11. Lines: 46
  12.  
  13. In article <3575@richsun.cpg.trs.reuter.com> jack@richsun.cpg.trs.reuter.com (Jack Gidding) writes:
  14. >
  15. >Hmmmm..... this is really strange and very undesired behavior from Objective-C.
  16. >
  17. >When I include the header files from two different classes into a third class,
  18. >and each of the included classes have a single init: method defined, I get
  19. >messages similar to the following:
  20. >
  21. >
  22. >main2.m:18: warning: multiple declarations for method `init:'
  23. >/Clib/RP.h:32: using `-init:(int )pSize'
  24. >/Clib/RS.h:31: also found `-init:(OBJPTR )s'
  25.  
  26. This is just a warning to alert you that these are 2 different methods that
  27. have the same name "- init:" but not the same parameter definition.  
  28. C++ would have treated this as 2 really different member functions that
  29. cannot override each other.  In Objective-C, you many have situations 
  30. where you wouldn't know what is the exact kind of object that you're 
  31. dealing with and then you wouldn't be sure what kind of parameter the
  32. method -init: (which is may be implemented in many of your classes)
  33. should take.
  34. For example: you have an OrdCltn called "ordCltn" where you mix objects 
  35. of classes RP and RS and you want to init: all it's members.
  36. Since init: receives different parameter in RP and RS, you would
  37. not be able to use the line:
  38. [ordCltn elementsPerform: @selector(init:) with: yourValue];
  39.  
  40. Anyway, it's only a warnning.
  41.  
  42.  
  43.  
  44.     ____
  45.      /  /   __ 
  46.     /  /   /_/ /| /
  47.  __/_ /__ / / / |/   o o o
  48.  
  49.                            Ilan Aisic
  50.            Israel                                 USA
  51. Voice:   972-4-344474                         1-914-644-7710
  52. Fax:     972-4-342492                         1-914-644-7763
  53. E-mail:  izeek@techunix.technion.ac.il        ilan@allink.com
  54. -- 
  55.  
  56.     ____
  57.      /  /   __ 
  58.     /  /   /_/ /| /
  59.