|A lesson in why one should not try to learn programming from a not-acclaimed source. In an attempt to find a reason to use references in C++ that doesn't suck, I came upon this explanation.
What is the difference between a pointer and a reference?
Note to people learning C++ - the above explanation is complete and utter drivel. Creating a pointer does not create an object. Creating a reference does not simply create an alternative name. There is no difference in the creation. Creating either one will allocate four bytes of storage in which an address will be stored. The only difference is one of syntax - the compiled behaviour of a pointer is exactly the same as the compiled behaviour of a reference. Take heed - the internet is full of lies. If anyone knows of a better reason to use references rather than pointers, other than for operator overloading, let me know.
Even though both pointers and references look similar (as they both hold the address of an object), they are intrinsically different. Creating a pointer to an object creates a new object whereas creating a reference simply creates an alternative name for an existing object.
We now return you to your regularly scheduled reduced-geekery blog.