home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / next / programm / 5936 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  1.4 KB

  1. Xref: sparky comp.sys.next.programmer:5936 comp.lang.objective-c:513
  2. Path: sparky!uunet!richsun!richsun.cpg.trs.reuter.com
  3. From: jack@richsun.cpg.trs.reuter.com (Jack Gidding)
  4. Newsgroups: comp.sys.next.programmer,comp.lang.objective-c
  5. Subject: Multiple init: functions defined
  6. Message-ID: <3575@richsun.cpg.trs.reuter.com>
  7. Date: 2 Sep 92 20:37:28 GMT
  8. Sender: news@richsun.cpg.trs.reuter.com
  9. Followup-To: comp.sys.next.programmer
  10. Lines: 40
  11.  
  12.  
  13. Hmmmm..... this is really strange and very undesired behavior from Objective-C.
  14.  
  15. When I include the header files from two different classes into a third class,  
  16. and each of the included classes have a single init: method defined, I get  
  17. messages similar to the following:
  18.  
  19.  
  20. main2.m:18: warning: multiple declarations for method `init:'
  21. /Clib/RP.h:32: using `-init:(int )pSize'
  22. /Clib/RS.h:31: also found `-init:(OBJPTR )s'
  23.  
  24.  
  25. Why is this happening??? Sometimes it tells me that it resolved which init to  
  26. use, sometimes not, and sometimes it resolves it to the wrong init:.
  27.  
  28.  
  29. The code that has the init method is sililar in form to:
  30.  
  31.     #import <RP.h>    // Both RP and RS have and init: method
  32.     #import <RS.h>
  33.  
  34.     id x;
  35.  
  36.     x = [[RP alloc] init:(int) 5];
  37.  
  38. id is totally dynamic, and thus it really does not know which init to use....
  39.  
  40. So, why is it telling me that it is using one method or another...shouldn't  
  41. this be left up until run-time? 
  42.  
  43.  
  44. Am I doing something wrong to cause this?
  45.  
  46.  
  47. Thanks,
  48.  
  49.  
  50. Jack Gidding
  51. jack@richsun.cpg.trs.reuter.com
  52.