home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16672 < prev    next >
Encoding:
Internet Message Format  |  1992-11-20  |  1.3 KB

  1. Path: sparky!uunet!olivea!charnel!rat!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!usenet.ucs.indiana.edu!news
  2. From: ezachris@iroquois.ucs.indiana.edu
  3. Newsgroups: comp.lang.c++
  4. Subject: Multiple Inheritance - Necessary?
  5. Keywords: c++ inheritance
  6. Message-ID: <By17An.4uH@usenet.ucs.indiana.edu>
  7. Date: 20 Nov 92 20:23:11 GMT
  8. Sender: news@usenet.ucs.indiana.edu (USENET News System)
  9. Organization: Indiana University
  10. Lines: 32
  11. Nntp-Posting-Host: iroquois.ucs.indiana.edu
  12.  
  13.  
  14. Hello!
  15.  
  16. A friend of mine who programs in Objective-C argues that multiple  
  17. inheritance is unnecessary and complicated. 
  18.  
  19. Let's say you have a pencil-object and an eraser-object and to create a  
  20. pencil-with-an-eraser-on-it you'd inherit from both the pencil and the  
  21. eraser object, right?
  22.  
  23. Like this:
  24.  
  25.           PENCIL           ERASER
  26.              ^              ^
  27.               \            /
  28.                \          /
  29.              PENCIL-WITH-ERASER
  30.  
  31. My Objective-C friend would make a new object "Pencil-with-eraser" that  
  32. would declare two objects inside it.
  33.  
  34. Like this:
  35.  
  36.      PENCIL-WITH-ERASER
  37.         Eraser TheEraser(...);
  38.         Pencil ThePencil(...);
  39.  
  40. To implement the functionality of the pencil and the eraser he'd write a  
  41. bunch of functions that call the functions inside the pencil and the  
  42. eraser objects. 
  43.  
  44. I think this sounds like hogwash. What do you think?
  45.