-
operator=
I'm trying to overload the = operator, and i get this error:
CBasicTemplateList.cpp(58) : error C2244: 'CTemplateList<T>::=' : unable to resolve function overload
Any ideas why?
The prototype is:
CTemplateNode<T>& operator=(const CTemplateList<T>& list);
Code:
template <class T>
CTemplateList<T>& CTemplateList<T> :: operator=(const CTemplateList<T>& list)
{
this->m_pNHead=list.m_pNHead;
this->m_pNTail=list.m_pNTail;
this->m_pNCurrent=list.m_pNCurrent;
return *this;
}
-
Re: operator=
Quote:
Originally posted by gazsux
The prototype is:
CTemplateNode<T>& operator=(const CTemplateList<T>& list);
Code:
template <class T>
CTemplateList<T>& CTemplateList<T> :: operator=(const CTemplateList<T>& list)
{
this->m_pNHead=list.m_pNHead;
this->m_pNTail=list.m_pNTail;
this->m_pNCurrent=list.m_pNCurrent;
return *this;
}
The prototype should match the function. Your prototype returns a CTemplateNode reference; while, the actual function returns a CTemplateList reference.
-
ahh alas it has been a long long day... :) ty good sir