home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20032 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  1.8 KB

  1. Xref: sparky comp.lang.c:20032 comp.lang.c++:19702
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!yale!mintaka.lcs.mit.edu!ai-lab!life.ai.mit.edu!tmb
  3. From: tmb@arolla.idiap.ch (Thomas M. Breuel)
  4. Newsgroups: comp.lang.c,comp.lang.c++
  5. Subject: Re: discriminated unions (Re: C/C++ Correctness (was: Re: C/C++ Speed))
  6. Date: 21 Jan 93 22:24:33
  7. Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
  8.     Perceptive)
  9. Lines: 32
  10. Message-ID: <TMB.93Jan21222433@arolla.idiap.ch>
  11. References: <TMB.93Jan20160311@arolla.idiap.ch> <1993Jan20.184221.19003@netcom.com>
  12.     <1993Jan21.004105.1335@ucc.su.OZ.AU> <1993Jan21.075642.6482@netcom.com>
  13. Reply-To: tmb@idiap.ch
  14. NNTP-Posting-Host: arolla.idiap.ch
  15. In-reply-to: erc@netcom.com's message of Thu, 21 Jan 1993 07:56:42 GMT
  16.  
  17. >>>>> On Thu, 21 Jan 1993 07:56:42 GMT, erc@netcom.com (Eric Smith) said:
  18.  
  19. > In article <1993Jan21.004105.1335@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  20. >>    Later I can write a breadth first search.
  21. >>    I dont have to change anything to write the breadth first search.
  22. >>    Its just a global function taking the tree as an argument.
  23. >
  24. > Ok, now I understand.  You want to be able to add functionality to a class
  25. > without changing the class itself nor deriving a new version of it.  Your
  26. > discriminated unions would be helpful toward that goal, but I still don't
  27. > see any overwhelming advantage of that goal.  The only real advantage I can
  28. > see is that you don't have to use a new class name for your new version.
  29. >
  30. > Other than cluttering class name space, are there any disadvantages in
  31. > deriving new classes to add functionality?
  32.  
  33. You can't add functionality to a class X by writing code for a class Y
  34. (derived from X). That is, your new BFS algorithm for objects of type
  35. Y (derived from X) won't work on objects of type X.
  36.  
  37.                     Thomas.
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.