home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!lll-winken!sundance!moonshine!jac
- From: jac@moonshine.llnl.gov (James A. Crotinger)
- Newsgroups: comp.lang.c++
- Subject: Re: Proposal: Subscripting with multiple arguments
- Message-ID: <jac.716576376@moonshine>
- Date: 15 Sep 92 16:59:36 GMT
- References: <1992Sep14.182942.1986@athena.mit.edu> <MATT.92Sep14161955@physics.berkeley.edu> <TMB.92Sep15134433@arolla.idiap.ch>
- Sender: news@sundance.llnl.gov (News Administrator)
- Organization: Magnetic Fusion Energy - LLNL
- Lines: 23
-
- tmb@arolla.idiap.ch (Thomas M. Breuel) writes:
- > What you can do, however, is to share a lot of code among the
- > different array classes. For example, you might have your
- > multidimensional array inherit from your 1D array.
-
- Not publicly, I hope. There is no "is a" relationship in that
- direction. (Well, you can say that a 2D array of floats is a 1D array
- of 1D arrays of floats, but that's not the same as inheritance since
- the types of the 2D and "outer" 1D arrays are different.) In one of
- our class libraries we did implement "Vector" (1D array) as inheriting
- from "Matrix" (2D array). This makes sense since a Vector is just a
- Matrix with only 1 column. Thus you can safely pass a Vector to any
- function which operates on Matrices, etc. You would not want to try to
- do the reverse.
-
- > Thomas.
-
- Jim
- --
- -------------------------------------------------/\--------------------------
- James A. Crotinger Lawrence Livermore N'Lab // \ The above views are mine
- jac@moonshine.llnl.gov P.O. Box 808; L-630 \\ //---\ and are not neces-
- (510) 422-0259 Livermore CA 94550 \\/Amiga\ sarily those of LLNL.
-