Q:

C++: Why do you need references when you have pointers?

Possible Duplicate:
C++: When to use References vs. Pointers
Could operator overloading have worked without references? 

I couldn't help it, but this fundamental question was on my mind: why does C++ have references when you could do with pointers just as well?
I know that in certain situations they are slightly safer and more often than not they make the code prettier, but technically there is no difference, right? So are there any situations where I couldn't do with a pointer and a reference is a must?
I would like to see specific examples of when using references is unavoidable.
Disclaimer:
I haven't found any answers to this on StackOverflow, this is not a question about the differences in syntax. I am wondering why the C++ language introduced references in the first place.

A:

Using pointers alone you can't properly pass-by-reference or return-by-reference.
Some methods require a reference. How would you implement a copy-constructor? 
Sometimes you need to enforce aliasing. You can't do that with pointers - they can be changed. References cannot bind to something different. So when you initialize a reference, you guarantee it will refer to the same object through its scope.
The safety issue
(const)References can bind to temporary objects. To create a temporary pointer, you'd need to free it inside the method you pass it to. But you can't tell if it's a temporary or not inside.

A:

Operator overloading. Using pointers for "passing via reference" would give you unacceptable syntax.

A:

If you have a pointer as a parameter, you have to check if it is NULL.
With references, you do have to make that check.
Here is why there is references in C++ from the man himself - http://www.stroustrup.com/bs_faq2.html#pointers-and-references

