Path: utzoo!attcan!uunet!isc-br!tau-ceti!cims2!proto!joe From: joe@proto.COM (Joe Huffman) Newsgroups: comp.lang.c++ Subject: Re: arrays of objects with multiple initializers Summary: Here's how the matrix class I use does it. Message-ID: <1355@proto.COM> Date: 1 Aug 90 23:22:47 GMT References: <1990Jul30.222115.2232@brutus.cs.uiuc.edu> Organization: Prototronics; Sandpoint, Idaho Lines: 24 In article <1990Jul30.222115.2232@brutus.cs.uiuc.edu>, nelson@melodian.cs.uiuc.edu (Taed Nelson) writes: > Over the weekend, I was working with a Matrix Class (courtesy of > Bob Olson), and it was a pain to initialize a matrix by setting > each element. Would it be possible to use a constructor that > somehow behaved like the autoinitialization of arrays? This is the way my (modified from Bruce Eckels book) matrix class handles it: class matrix { private int rows, cols; double *mat_p; [...] public: matrix (int rows, int cols, const double *init_p = 0); [...] }; -- joe@proto.com uunet!proto!joe FAX: 208-263-8772