Im actually looking for the answer too, kmce, if you can answer your own question please tell me the answer, cires answer has confused me a little bit. thanks
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
void display( const std::vector<std::string>& vec )
{
// the name of the variable (the formal parameter to the function) is 'vec'
// the type of the variable is 'reference to const std::vector<std::string>'
// each time the function is called, the variable 'vec' is created and initialised
for( constauto& str : vec ) std::cout << std::quoted(str) << ' ' ;
std::cout << '\n' ;
// the variable 'vec' goes out of scope when the function returns
// the next time the function is called, it is created and initialised afresh
}
int main()
{
std::vector<std::string> vector_a { "zero", "one", "two", "three", "four" } ;
// the name of the variable is 'vector_a'
// the type of the variable is 'std::vector<std::string>'
display(vector_a) ;
// the semantics of passing an argument to a function is the semantics of initialisation.
// 'vec' in the function display is seated on the object 'vector_a'
std::vector<std::string> vector_b { "nihil", "unus", "duo", "tres", "quattuor" } ;
// the name of the variable is 'vector_b'
// the type of the variable is 'std::vector<std::string>'
display(vector_b) ;
// the semantics of passing an argument to a function is the semantics of initialisation.
// 'vec' in the function display is initialised to refer to the object 'vector_b'
}
Sometimes people use phrasing like "the reference is the referent" or "a reference is like an 'automatic' pointer", which are strictly wrong, because they don't capture the whole picture.
If you want a phrase to explain references with, "a reference is an alias for its' referred-to-object (referent)" is alright. It's impossible to do anything with the reference itself - anything you try to do to the reference is done to the referent.
Still, "alias" doesn't capture the whole picture, because it doesn't explain dangling references nor references bound to an object whose referenced type differs from the referent's type, nor lifetime extension of temporaries which happen to be bound to a constant reference. (And maybe some other subtleties that I can't think of now.)
For these things, I don't know of any simple analogy. Still, you should be able to get by just fine with an analogy of your choice, as long as you know that it's simplified.
Maybe it would be better to just explain the rules without trying to teach references in one sentence. ;-)