What is a reference?

Oct 30, 2012 at 6:16pm
What exactly is a reference? What does it consist of? Contains it an address, just like a pointer?
Oct 30, 2012 at 6:20pm
closed account (3qX21hU5)
Google and searches are powerful things ;p

http://www.cplusplus.com/articles/1075fSEw/

and

http://www.cplusplus.com/reference/

or

http://en.wikipedia.org/wiki/Reference_(C%2B%2B)
Last edited on Oct 30, 2012 at 6:22pm
Oct 30, 2012 at 7:14pm
It's another name for some object. You use it just like you would the object that it is another name for.

How it is implemented is not specified in the C++ standard. It may use pointers, it may not, but it is not and should not be treated like a pointer. It should be treated like another name for some exact same object.
Oct 30, 2012 at 7:17pm
OK, thanks.
Topic archived. No new replies allowed.