From: "Grigoriy Strokin" Newsgroups: comp.os.msdos.djgpp References: <67uo86$u$1 AT cubacola DOT tninet DOT se> Subject: Re: Plain C++ question about classes... Date: Sat, 27 Dec 1997 17:49:28 +0300 Lines: 23 NNTP-Posting-Host: isabase.philol.msu.ru Message-ID: <34a5157a.0@boy.nmd.msu.ru> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk >CImageBuffer buffer1(320,200); /* creates a 320x200 buffer */ >CImageBuffer buffer_array[100](320,200); /* this thing is BAD */ > >the first line creates a buffer and sends the two arguments for the >constructor, but the second line is illegal, because it's an array. How Do i >write the second line in the right way ????????????????? You would use pointers instead of static arrays and then initialize each object within a cycle: CImageBuffer **buffer_array = new (CImageBuffer*)[100]; int i; for (i=0; i < 99; i++) { buffer_array[i] = new CImageBuffer(320, 200); buffer_array[i]->SomeOtherActions(); ... }