Mail Archives: djgpp/1997/12/28/11:34:51
>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();
...
}
- Raw text -