some issues

Started by
1 comment, last by fatherjohn666 21 years, 9 months ago
When reading a tutorial I come across operators etc. Is there a dsicernable difference between say const CVector& operator== and const CVector &operator== surely the ampersand has a different meaning depending on what is hooks onto? can someone clear this up for us? cheers. I would have thought the ampersand would sit next to operator, but the tutorials I follow have them varied sometimes??? is this a misprint or.... the more common one in the tuts I follow is my first example cheers Im just a beginner!!! http://www.actsofgord.com
~~~~~~~~~~~~~~~~~~~~~~~~~http://on.to/oni
Advertisement
It''s both the same.

But the spelling

const CVector& operator ==

should be considered the better one.
The & operator marks a reference. In this case, the operator ==
returns a constant reference to a CVector object. It would not
make sense to bind the & more to the operator keyword as it
really belongs to the return value (CVector).
cheers mate



Im just a beginner!!!

http://www.actsofgord.com
~~~~~~~~~~~~~~~~~~~~~~~~~http://on.to/oni

This topic is closed to new replies.

Advertisement