Re: Reference variable
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Mon, 16 Jun 2008 09:03:47 -0500
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&".
.
- References:
- Reference variable
- From: Jack
- Reference variable
- Prev by Date: Re: Unable to link (static MFC)
- Next by Date: Re: program caueses computer restart once in a while
- Previous by thread: Re: Reference variable
- Next by thread: hi check this
- Index(es):