home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 16215 < prev    next >
Encoding:
Text File  |  1992-11-13  |  1.7 KB  |  42 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!sakkinen
  3. From: sakkinen@jyu.fi (Markku Sakkinen)
  4. Subject: Re: Multiple representation of an object type
  5. Message-ID: <1992Nov13.083112.7875@jyu.fi>
  6. Organization: University of Jyvaskyla, Finland
  7. References: <BxDGKn.4u2@news.orst.edu>
  8. Date: Fri, 13 Nov 1992 08:31:12 GMT
  9. Lines: 31
  10.  
  11. In article <BxDGKn.4u2@news.orst.edu> gnk@belar.ECE.ORST.EDU (Giri Rangan) writes:
  12. >I am in search of a correct and a very efficient way of implementing
  13. >multiple representations of an object type. Here is an example :
  14. >
  15. >I have a polynomial class. A polynomial can be represented in two ways.
  16. >One is to store the coefficients of each order term and the other way
  17. >is to store the roots of the polynomial. Both the representations are
  18.                  ^^^^^
  19. evidently meaning 'factors'
  20.  
  21. > ...
  22. >Another point to note is that the two representations are inter
  23. >convertible. As a result, if I change a particular coefficient, then
  24. >the present roots of the polynomial are no longer valid. They will have
  25. >to change too.
  26. > ...
  27.  
  28. An exactly analogous situation (complex numbers in both Cartesian
  29. and polar representation) happens to be well presented
  30. in Meyer's "Object-Oriented Software Construction", 7.7.4 (p. 136 - 139).
  31. The code is in Eiffel, but you'll get the idea.
  32.  
  33. ----------------------------------------------------------------------
  34. Markku Sakkinen (sakkinen@jytko.jyu.fi)
  35.        SAKKINEN@FINJYU.bitnet (alternative network address)
  36. Department of Computer Science and Information Systems
  37. University of Jyvaskyla (a's with umlauts)
  38. PL 35
  39. SF-40351 Jyvaskyla (umlauts again)
  40. Finland
  41. ----------------------------------------------------------------------
  42.