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();