title: expected initializer before ‘*’ token
body: <p>I am trying to implement the code in the <em>Design Patterns</em> book.  I am getting the following error:</p>
  
  <pre><code>expected initializer before ‘*’ token
  </code></pre>
  
  <p>for this line:</p>
  
  <pre><code>static Singleton *Singleton::itsInstance = 0;
  </code></pre>
  
  <p>Here's the complete code.  I am using g++ 4.2.1 to try and compile this.</p>
  
  <pre><code>class Singleton {
  public:
      static Singleton *instance();
  protected:
      Singleton();
  private:
      static Singleton *itsInstance;
  }
  
  static Singleton *Singleton::itsInstance = 0;
  
  Singleton *Singleton::instance()
  {
      if (!itsInstance)
      {
          itsInstance = new Singleton;
      }
      return itsInstance;
  }
  </code></pre>
  
  <p>Any ideas?</p>