You would call the functions differently.
Code:
// in order of appearance:
fixFlatTire(&myCar);
fixFlatTire(myCar);
What happens in these functions also looks different. The pointer version has this inside:
Code:
void fixFlatTire(Car *myCar)
{
if (myCar != NULL) {
myCar->removeLugnuts();
myCar->exchangeTire(new Tire);
myCar->screwonLugnuts();
}
else {
panic();
}
}
The reference version...
Code:
void fixFlatTire(Car &myCar)
{
myCar.removeLugnuts();
mycar.exchangeTire(new Tire);
myCar.screwonLugnuts();
}
Maybe something like that? It's complicated...
So that is the difference. Syntactically no big deal, but with the pointer version, you have to make sure that the pointer points to an object, and handle times when it doesn't. References are always an object with a different name, so there is nothing to really check, (unless you are too clever it won't break,) but references can't be reassigned a new object like pointers can. So pick whatever you need the variable to do.