View Single Post
Old Nov 29th, 2006, 7:24 PM   #3
aznballerlee
Hobbyist Programmer
 
Join Date: Nov 2006
Posts: 111
Rep Power: 2 aznballerlee is on a distinguished road
I'm trying to tackle the
bool Valley::addEnergySource (int r, int c)
now. Once again, stuck.

I believe I'm getting ideas confused. I'll show you what I have:

the task:
bool Valley::addEnergySource(int r, int c)
{
    //      TODO: implement addEnergySource
    //      If MAXSOURCES have already been added, return false.  Otherwise,
    //      dynamically allocate a new energy source at coordinates (r,c).
    //      Save the pointer to the newly allocated energy source and return true.
    //      (Hint:  The Valley class could contain a private array with MAXSOURCES
    //      elements.)
    return true;
}
Here's my code:
if (MAXSOURCES)
    return false;
else
//    ?  = new Energysource();
aznballerlee is offline   Reply With Quote