title: C++: using & operator for pass-by-reference
body: <p>I'm teaching myself C++, and in the process I'm writing simple little programs to learn basic ideas.  With respect to "pass-by-reference", I'm confused why the following piece of code works (some of the code is just there to practice overloading constructors):</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  class Dude
  {
  public:
    string x;
    Dude();                    // Constructor 1
    Dude(const string &amp;a);     // Constructor 2
  };
  
  Dude::Dude() : x("hi") {}
  Dude::Dude(const string &amp;a) : x(a) {}
  
  int main()
  {
    Dude d1;
    Dude d2 = Dude("bye");
  
    cout &lt;&lt; d1.x &lt;&lt; endl;
    cout &lt;&lt; d2.x &lt;&lt; endl;
  
    return 0;
  }
  </code></pre>
  
  <p>In "main()", I create an object "d2" of type "Dude", and use Constructor 2 to set "x" to be the string "bye".  </p>
  
  <p>But in Constructor 2's declaration, I told it to accept an <em>address</em> of a string, not a string itself.  So why can I pass it "bye" (which is a string).  Why don't I have to create a variable string, and then pass the address of that string to Constructor 2 of Dude?</p>