This is the definition of the member function:
const cAssignmentOprOverload& cAssignmentOprOverload::operator=
(const cAssignmentOprOverload& otherList)
{
if(this != &otherList) //avoid self-assognment
{
if(list != NULL)
destroyList ();
maxSize = otherList.maxSize;
length = otherList.length;
if(maxSize != 0)
{
list = newint[maxSize];
assert(list != NULL);
for(int i = 0; i < length; i++)
list[i] = otherList.list[i];
}
else
list = NULL;
}
return *this;
}
//Please help with writing the test program for this member function.
I eventually managed to write the test program to overload the operator=
The main program runs very well without changing anything i the definition of the
function to overload the assignment operator=