#include <iostream.h>
class myClass
{
public:
myClass(int val=0):myValue(val) { cout << "In myClass constructor\n"; }
myClass(const myClass & rhs):myValue(rhs.myValue) { cout << "In myClass copy constructor\n"; }
~myClass() { cout << "In myClass Destructor\n"; }
int GetValue() const { return myValue; }
void SetValue(int theVal) { myValue = theVal; }
private:
int myValue;
};
void someFunction();
int main()
{
cout << "In main, ready to call someFunction..." << endl;
someFunction();
cout << "In main, returned from someFunction." << endl;
return 0;
}
void someFunction()
{
const int arraySize = 5;
myClass * pArray = new myClass[arraySize];
for (int i = 0; i < arraySize; i++)
pArray[i].SetValue(i);
for (int j = 0; j < arraySize; j++)
cout << "pArray[" << j << "]: " << pArray[j].GetValue() << endl;
delete [] pArray;
}