delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/26/08:22:30

Date: Fri, 26 Dec 97 15:08:42 PST
From: Noam Rotem <nrotem AT johnbryce DOT co DOT il>
Subject: RE: Plain C++ question about classes...
To: Jimmy Myhrman <myhrman AT algonet DOT se>
Cc: djgpp AT delorie DOT com
Message-ID: <Chameleon.971226151741.nrotem@netvision.netvision>
MIME-Version: 1.0

--- On Thu, 25 Dec 1997 23:51:33 +0100  Jimmy Myhrman 
<myhrman AT algonet DOT se> wrote:

>I wonder how I can create an array of an object of a class 
with a
>constructor...hmm, did you understand that ?, look at this 
code instead:
>
>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 ?????????????????

AFAIK, You can't.

Use the default constructor:
 
CImageBuffer buffer_array[100];

Now run a loop to set the initial values...

I just hope there is a default constructor for this class.

Heap heap array!

---------------------------------------------
Noam Rotem
John Bryce Training Centre
Tel Aviv, Israel.
03-7535803
=============================================
1. Take upon yourself an impossible mission.
2. Accomplish the mission.
3. Go back to step 1.

It's the only sane answer to modern life.

---
26/12/97
15:08:42

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019