~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
C++ Upsets Me / over 2 years ago
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

I promise $25 to the first person who can explain to me what the difference here is:

error: no matching function for call to `Station::setStationAnimationID(int)’ note: candidates are: void Station::setStationAnimationID(int&)

SCREAMING

--------------------
:::Comments:::

\__________ Patrick -- about 2 years ago __________/
int& is a pointer to a memory location. int is a variable. If it's expecting a memory address 0xff0044 or whatever, and instead it gets the value in that location, it will give you an error (if you're lucky) or simply malfunction when executed.
--------------------
\__________ Me -- about 2 years ago __________/
Then what's the difference between that (int&) and an explicit pointer (e.g., void Station::setStationAnimationID(int*))? I understand the pass-by-reference/pass-by-value distinction for objects, but I can't see that it's a useful distinction for primitives, and I don't know why that would effect the caller either.
--------------------
(New comment)