Overload the relational operator ==for the class stackTypethat returns trueiftwo stacks of the same type are the same; falseif otherwise.
my code:
template <class Type>
const stackType<Type>& stackType<Type>::operator ==
(const stackType<Type>& otherStack)
{
if (this->stackTop != otherStack.stackTop)
return false;
for (int i = 0; i < stackTop; i++)
if (this->list[i] != otherStack.list[i])
return false;
return true;
} //end operator==
I'm receiving a returning reference to local temporary object warning and from what i understand is that it's being destroyed once the function scope ends. Can anyone point me in the right direction to solving this warning?