home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13689 < prev    next >
Encoding:
Internet Message Format  |  1992-09-15  |  1.6 KB

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