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