title: C++ singleton implementation
body: <p>I was studying an example of Singleton Pattern in c++.</p>
  
  <pre><code>class Singleton
  {
      private:
          static Singleton oneandonly;
          Singleton(){};
          ~Singleton(){};
          Singleton(const Singleton &amp;);
          Singleton &amp; operator= (const Singleton &amp;);
      public:
          static Singleton &amp;getInstance(){ return oneandonly; };
  }
  </code></pre>
  
  <p>I do not understand what following line do.</p>
  
  <pre><code>Singleton(const Singleton &amp;);
  </code></pre>
  
  <p>I always used const for methods but now is for the formal parameter of the method, and the '&amp;' does have any particular meaning or is just an odd name.
  And then the line: 
  <code>static Singleton &amp;getInstance(){ return oneandonly; };</code>
  Why there is a &amp; in front of the method?</p>