Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


some issues

This topic is 5964 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post

Link to post
Share on other sites
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).

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!