Original Post
correct me if im wrong, but a copy constructor is needed for the operator= to work?
i have a Vector3 class.
i have operators * + - / and ^ implemented.
i implemented a = operator today. cant figure out if its working because the project compiles, builds, runs, and even accepts code that says Vector3 vect = oldvec (when i comment out the operator= function).
this is odd since the Vector3 class shouldnt know what operator= means since its not an operator.
here are those functions
// operator=
CVector3& operator= ( const CVector3 &v )
{
if (this != &v)
{
m_X = v.m_X;
m_Y = v.m_Y;
m_Z = v.m_Z;
}
return *this;
}
// Copy constructor.
CVector3( CVector3<T> &v )
{
m_X = v.m_X;
m_Y = v.m_Y;
m_Z = v.m_Z;
}