   an & symbol
  The critter farm program in chapter nine of the Begginning c++ game programing book has a few & symbols that don't seem to have a purpose. I tried taking them out, and compiling it. I didn't get an error and the program didn't run differently at all.Heres the section of code://Critter Farm//Demonstrates object containment#include <iostream>#include <string>#include <vector>using namespace std;class Critter{public:    Critter(const string& name = ""): m_Name(name) {}    string GetName() const { return m_Name; }  private:    string m_Name;};The & is at the end of string in the constructor part of the critter class.What does it do?Thanks in advance for the help.   
  When you use the & symbol like that. It means that the variable is being passed as a reference.When you do &myVar, what is actually returned is the address of that variable. i.e.CMyClass myClass();CMyClass *pClass = &myClass;   ;  That is called a reference.  You can use it like it were a normal variable, but internally it acts as a pointer.Link to tutorial;  It makes it a reference. In memory it's referencing the variable you pass in. If you leave off the &, it just creates a new variable in memory. Here is what happens.With a reference:dosomething(string &var){   var = "you win";}...string myval = "something";dosomething(myval)cout << myval;  the output is 'you win'Without a reference:dosomething(string var)...string myval = "something";dosomething(myval)cout << myval;the output is 'something'