home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!caen!hellgate.utah.edu!fcom.cc.utah.edu!val
- From: val@news.ccutah.edu (Val Kartchner)
- Subject: Re: Squares and Rectangles (Re: Const Inheritance)
- Message-ID: <1992Nov20.012340.19437@fcom.cc.utah.edu>
- Sender: news@fcom.cc.utah.edu
- Organization: University of Utah Computer Center
- X-Newsreader: Tin 1.1 PL3
- References: <1992Nov19.171731.23740@ucc.su.OZ.AU>
- Date: Fri, 20 Nov 92 01:23:40 GMT
- Lines: 43
-
- In article <721507350snx@trmphrst.demon.co.uk> nikki@trmphrst.demon.co.uk writes:
- >In article <1992Nov4.165028.1273@wam.umd.edu> krc@wam.umd.edu (Kevin R. Coombes) writes:
- >> From a mathematical point of view, there is no question about the
- >> relationship that should hold. Every rectangle IS-A polygon, with
- >> four sides and four right angles. Every square IS-A rectangle with
- >> four equal sides.
-
- >I think our problem here is that we have two separate meanings of "is-a".
- >In the geometrical sense, any particular Square "is-a" Rectangle.
-
- The mathematical heirarchy is inverted for OO. Perhaps the "is-a" relationship
- should be "is-a-...-with-additions". For example:
-
- shape // Abstract base class
- ^
- |
- square // base class
- ^
- |
- rectangle // a square with both dimensions adjustable
- ^
- |
- parallelogram // a rectangle with an adjustable angle
- ^ // (The other angle is derivable.)
- |
- quadrilateral // a parallelogram with three sides adjustable
- ^ // (The fourth side is determined by the one angle.)
- |
- polygon // a quadrilateral with number of sides adjustable
- ^ // (This also complicates the angles.)
- |
- something // a polygon where "sides" don't have to be straight
- // lines (This really complicates things.)
-
- There would also be other branches in the 'shape' heirarchy, but this
- illustrates the principle.
-
- -=:[ VAL ]:=-
- --
- |================== #include <disclaimer.h> ==================///=============|
- | "AMIGA: The computer for the creative mind" (tm) Commodore /// Weber State |
- | "Macintosh: The computer for the rest of us"(tm) Apple \\\/// University |
- |== "I think, therefore I AMiga" -- val@csulx.weber.edu ==\///= Ogden UT USA =|
-