Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!enuxha!hocker From: hocker@enuxha.eas.asu.edu (Charles C. Hocker) Newsgroups: comp.lang.c++ Subject: Array of class objects Keywords: array, initialization, class objects Message-ID: <1756@enuxha.eas.asu.edu> Date: 13 Nov 90 17:43:46 GMT Organization: Arizona State University, Tempe, AZ Lines: 41 Hello, I am having touble trying to created an array of objects of class pnt using TC++. My code is as follows: class pnt { public: int X, Y, Z; pnt (int x = 0, int y = 0, int z = 0) {X=x; Y=y; Z=z;} }; class pnts { public: int Count; pnt Pnts [MAX_PNTS]; // pnt from above pnts (int count = 0) {Count = count;} }; int main (void) { pnts Points; // ... } I recieve an error to the effect "cannot find pnt::pnt()" when I compile my program. I have tried to use several different methods for getting the code segment to work and have found not that will work. The ARM gives a reference on page 289, section 12.6.1, but I still recieve the error about "pnt::pnt() not found" when I use: pnt Pnts [MAX_PNTS] = {pnt ()} Although the ARM talks of initializing the array of objects, it talks about not being able to initialize an array of objects with constructors. Sincerly Charles C. Hocker hocker@enuxha.eas.asu.edu