title: Any differences between f(const string &) and f(const string )?
body: <pre><code>class mystring {
   friend ostream&amp; operator&lt;&lt;(ostream &amp;out, const mystring ss) {
          out &lt;&lt; ss.s;
          return out;
      }
  private:
      string s;
  public:
      mystring(const char ss[]) {
          cout &lt;&lt; "constructing mystring : " &lt;&lt; ss &lt;&lt; endl;
          s = ss;
      }
  };
  
  void outputStringByRef(const mystring &amp;ss) {
   cout &lt;&lt; "outputString(const string&amp; ) " &lt;&lt; ss &lt;&lt; endl;
  }
  
  void outputStringByVal(const mystring ss) {
   cout &lt;&lt; "outputString(const string ) " &lt;&lt; ss &lt;&lt; endl;
  }
  
  int main(void) {
      outputStringByRef("string by reference");
      outputStringByVal("string by value");
      outputStringByRef(mystring("string by reference explict call mystring consructor"));
      outputStringByVal(mystring("string by value explict call mystring constructor"));
  } ///:~
  </code></pre>
  
  <p>Considering the above example,we could not modify the pass-by-reference variable,neither could we modify the pass-by-value variable.The output of each methods is same.Since there is no difference between these two method,why do C++ support both methods?</p>
  
  <p>thanks.</p>