Re: Reference variable



Jack wrote:
I don't know if this is a silly question.

error C2440: 'initializing' : cannot convert from 'cMatrix4' to
'cVector3 &'
I want to be able to do this...
cVector3& position((cMatrix4) m_endeffector.TransformationMatrix);

where in cVector3, I have a copy constructor
cVector3::cVector3(const cMatrix4& mat)
{
...
}

Ahh, you are trying to pass in a temporary object created by the
user-defined conversion. But the argument is a non-const reference and
temporaries can only be bound to const reference. Try changing position to
take a parameter of type "const cVector3&".


.