home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13514 < prev    next >
Encoding:
Text File  |  1992-09-10  |  1.4 KB  |  48 lines

  1. Path: sparky!uunet!dtix!darwin.sura.net!spool.mu.edu!agate!ucbvax!ucdavis!dionne!wagner
  2. From: wagner@ike.ucdavis.edu (John Wagner)
  3. Newsgroups: comp.lang.c++
  4. Subject: new array w/ initializers...
  5. Message-ID: <16945@ucdavis.ucdavis.edu>
  6. Date: 11 Sep 92 03:40:12 GMT
  7. Sender: usenet@ucdavis.ucdavis.edu
  8. Reply-To: wagner@ike.ucdavis.edu
  9. Organization: University of California, Davis
  10. Lines: 36
  11.  
  12. something like the following:
  13.  
  14. class Vector {
  15.     private:
  16.         double *vals;
  17.         int dim;
  18.     public:
  19.         Vector (int dimension) {
  20.             etc...
  21.         }
  22.     ...
  23. };  //  End Class Vector
  24.  
  25. main () {
  26.     Vector *vecs;
  27.     vecs = new Vector[10] (3);
  28. }
  29.  
  30. The intent is to create an array of Vectors of dimension 3.
  31. I have run into this problem over and over again, and I don't
  32. see any logical reason for this not being possible (except
  33. possibly oversight).  Surely others have had this same idea.
  34.  
  35. ---
  36. John Wagner
  37. Institute of Theoretical Dynamics
  38. University of California, Davis
  39.  
  40. Bush/Quayle 1992: Saddam has a job, do you?
  41.  
  42. My opinions aren't even mine, much less those of anyone else...
  43. +------------------------------------+----------------------------+
  44. | jmwagner@ucdavis.edu               | Wenn Du meinen Quelltext   |
  45. | jmwagner@ucdavis                   | verstehen kannst, bist Du  |
  46. | {ucbvax, lll-crg}!ucdavis!jmwagner | mir einen Schritt voraus!  |
  47. +------------------------------------+----------------------------+
  48.