home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16610 < prev    next >
Encoding:
Text File  |  1992-11-19  |  2.1 KB  |  56 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!caen!hellgate.utah.edu!fcom.cc.utah.edu!val
  3. From: val@news.ccutah.edu (Val Kartchner)
  4. Subject: Re: Squares and Rectangles (Re: Const Inheritance)
  5. Message-ID: <1992Nov20.012340.19437@fcom.cc.utah.edu>
  6. Sender: news@fcom.cc.utah.edu
  7. Organization: University of Utah Computer Center
  8. X-Newsreader: Tin 1.1 PL3
  9. References: <1992Nov19.171731.23740@ucc.su.OZ.AU>
  10. Date: Fri, 20 Nov 92 01:23:40 GMT
  11. Lines: 43
  12.  
  13. In article <721507350snx@trmphrst.demon.co.uk> nikki@trmphrst.demon.co.uk writes:
  14. >In article <1992Nov4.165028.1273@wam.umd.edu> krc@wam.umd.edu (Kevin R. Coombes) writes:
  15. >> From a mathematical point of view, there is no question about the
  16. >> relationship that should hold. Every rectangle IS-A polygon, with
  17. >> four sides and four right angles. Every square IS-A rectangle with
  18. >> four equal sides. 
  19.  
  20. >I think our problem here is that we have two separate meanings of "is-a".
  21. >In the geometrical sense, any particular Square "is-a" Rectangle.
  22.  
  23. The mathematical heirarchy is inverted for OO.  Perhaps the "is-a" relationship
  24. should be "is-a-...-with-additions".  For example:
  25.  
  26.     shape        // Abstract base class
  27.        ^
  28.        |
  29.     square        // base class
  30.        ^
  31.        |
  32.     rectangle    // a square with both dimensions adjustable
  33.        ^
  34.        |
  35.     parallelogram    // a rectangle with an adjustable angle
  36.        ^        // (The other angle is derivable.)
  37.        |
  38.     quadrilateral    // a parallelogram with three sides adjustable
  39.        ^        // (The fourth side is determined by the one angle.)
  40.        |
  41.     polygon        // a quadrilateral with number of sides adjustable
  42.        ^        // (This also complicates the angles.)
  43.        |
  44.     something    // a polygon where "sides" don't have to be straight
  45.             // lines  (This really complicates things.)
  46.  
  47. There would also be other branches in the 'shape' heirarchy, but this
  48. illustrates the principle.
  49.  
  50.             -=:[ VAL ]:=-
  51. --
  52. |================== #include <disclaimer.h> ==================///=============|
  53. | "AMIGA: The computer for the creative mind" (tm) Commodore /// Weber State  |
  54. | "Macintosh: The computer for the rest of us"(tm) Apple \\\///   University  |
  55. |== "I think, therefore I AMiga" -- val@csulx.weber.edu ==\///= Ogden UT USA =|
  56.