-
Ok I need your help
/* Consider the following............*/
[code]
// Listing 13.7 - An array on the free store
#include <iostream>
class CAT
{
public:
CAT() { itsAge = 1; itsWeight=5; }
~CAT();
int GetAge() const { return itsAge; }
int GetWeight() const { return itsWeight; }
void SetAge(int age) { itsAge = age; }
private:
int itsAge;
int itsWeight;
};
CAT :: ~CAT()
{
// cout << "Destructor called!\n";
}
int main()
{
CAT * Family = new CAT[500];
int i;
for (i = 0; i < 500; i++)
{
Family[i].SetAge(2*i +1);
}
for (i = 0; i < 500; i++)
{
std::cout << "Cat #" << i+1 << ": ";
std::cout << Family[i].GetAge() << std::endl;
}
delete [] Family;
int exit; cin>>exit;
return 0;
}
/* Which is place here on the stack and which is placed on free store in terms of the array and the object */
-
once again thank you I think I got it though.