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

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!batcomputer!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  3. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  4. Subject: Re: Squares and Rectangles (Re: Const Inheritance)
  5. Message-ID: <1992Nov19.171731.23740@ucc.su.OZ.AU>
  6. Sender: news@ucc.su.OZ.AU
  7. Nntp-Posting-Host: extro.ucc.su.oz.au
  8. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  9. References: <721507350snx@trmphrst.demon.co.uk>
  10. Date: Thu, 19 Nov 1992 17:17:31 GMT
  11. Lines: 27
  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. But, 
  22. >geometrically, the shape of any given object is fixed, so setWidth() and
  23. >setHeight() methods do not make sense geometrically. If you make all 
  24. >objects of fixed size and shape, then a Square is-indeed-a Rectangle.
  25.  
  26.     More or less mathematical 'objects' are values, and not
  27. 'OO' objects (which tend to be mutable). Using classes for these things
  28. is more in the ADT flavour than OO.
  29.  
  30.     An abstract class 'Shape' may allow, for example an
  31. 'Expand' function for 'located' objects that have a definite
  32. point (about which to expand) and exist in a coordinate frame,
  33. but couldnt have a 'SetWidth' function.
  34.  
  35. -- 
  36. ;----------------------------------------------------------------------
  37.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  38.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  39. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  40.