Click here to Skip to main content
15,906,455 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: An easy one for you pro's... Pin
Nick Parker5-Dec-02 1:44
protectorNick Parker5-Dec-02 1:44 
GeneralRe: An easy one for you pro's... Pin
Christian Graus5-Dec-02 6:37
protectorChristian Graus5-Dec-02 6:37 
GeneralRe: An easy one for you pro's... Pin
Nick Parker5-Dec-02 6:42
protectorNick Parker5-Dec-02 6:42 
GeneralRe: An easy one for you pro's... Pin
Tim Smith5-Dec-02 2:19
Tim Smith5-Dec-02 2:19 
GeneralRe: An easy one for you pro's... Pin
Brent Lamborn5-Dec-02 5:05
Brent Lamborn5-Dec-02 5:05 
GeneralRe: An easy one for you pro's... Pin
Christian Graus5-Dec-02 6:38
protectorChristian Graus5-Dec-02 6:38 
GeneralRe: An easy one for you pro's... Pin
Brent Lamborn5-Dec-02 7:16
Brent Lamborn5-Dec-02 7:16 
GeneralRe: An easy one for you pro's... Pin
Christian Graus5-Dec-02 7:30
protectorChristian Graus5-Dec-02 7:30 
student() wrote:
for(int i = 0; i < iColSize; i++)
Organism aOrgArray[i] = {new Organism (iNumChroms)};


You seem to be trying to impliment what Nick gave you rather than what I said. With all due respect to Nick, in this case he is mistaken, this code will not work. I don't see where you have actually created this array, for starters, and to assign values like this you'd need to be using the heap.

Organism * aOrgArray = new Organism [iColSize];

for (int i = 0; ....)
aOrgArray[i] = new Organism(iNumChroms];

don't forget delete [] aORgArray; at the end if you do it this way. The other is to provide a constructor that takes no arguments, and then you can do this:

Organism [20] aOrgArray; // A const int value may work, I am not sure.

for (int i = 0;.....
aOrgArray[i].SetNumberChroms(iNumChroms);

Method B is neater IMO.


Christian

No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002

C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002

Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
GeneralRe: An easy one for you pro's... Pin
Brent Lamborn5-Dec-02 9:30
Brent Lamborn5-Dec-02 9:30 
GeneralRe: An easy one for you pro's... Pin
Christian Graus5-Dec-02 9:39
protectorChristian Graus5-Dec-02 9:39 
GeneralHelp with an Array of Controls and message maps Pin
VanHlebar4-Dec-02 13:47
VanHlebar4-Dec-02 13:47 
GeneralRe: Help with an Array of Controls and message maps Pin
Roger Allen5-Dec-02 1:27
Roger Allen5-Dec-02 1:27 
GeneralRe: Help with an Array of Controls and message maps Pin
VanHlebar5-Dec-02 1:48
VanHlebar5-Dec-02 1:48 
GeneralRe: Help with an Array of Controls and message maps Pin
Roger Allen5-Dec-02 3:13
Roger Allen5-Dec-02 3:13 
GeneralRe: Help with an Array of Controls and message maps Pin
VanHlebar5-Dec-02 11:07
VanHlebar5-Dec-02 11:07 
GeneralChanging the toolbar Pin
Rand Al'thor4-Dec-02 12:40
Rand Al'thor4-Dec-02 12:40 
GeneralRe: Changing the toolbar Pin
Rand Al'thor4-Dec-02 15:23
Rand Al'thor4-Dec-02 15:23 
GeneralAdd grid control to a dialog Pin
peter ho4-Dec-02 12:35
peter ho4-Dec-02 12:35 
GeneralRe: Add grid control to a dialog Pin
Christian Graus4-Dec-02 15:29
protectorChristian Graus4-Dec-02 15:29 
GeneralRe: Add grid control to a dialog Pin
Kannan Kalyanaraman4-Dec-02 19:18
Kannan Kalyanaraman4-Dec-02 19:18 
GeneralDisabled Pin
Larsson4-Dec-02 12:29
Larsson4-Dec-02 12:29 
GeneralRe: Disabled Pin
tongc4-Dec-02 14:34
tongc4-Dec-02 14:34 
GeneralRe: Disabled Pin
Larsson5-Dec-02 4:03
Larsson5-Dec-02 4:03 
QuestionUtility to scan for unused headers? Pin
Andrew Welch4-Dec-02 12:22
Andrew Welch4-Dec-02 12:22 
GeneralCDatabase Pin
MFC is the Best4-Dec-02 12:03
MFC is the Best4-Dec-02 12:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.