title: Can a static member variable call non-static member functions?
body: <p>I saw the following code:<br>
  <a href="http://sourcemaking.com/design_patterns/singleton/cpp/1" rel="nofollow">http://sourcemaking.com/design_patterns/singleton/cpp/1</a></p>
  
  <pre><code>class GlobalClass
  {
  private:
      int m_value;
      static GlobalClass *s_instance;
      GlobalClass(int v = 0)
      {
          m_value = v;
      }
  public:
      int get_value()
      {
          return m_value;
      }
      void set_value(int v)
      {
          m_value = v;
      }
      static GlobalClass *instance()
      {
          if (!s_instance)
              s_instance = new GlobalClass;
          return s_instance;
      }
  };
  
  GlobalClass *GlobalClass::s_instance = 0;
  
  void foo(void)
  {
      GlobalClass::instance()-&gt;set_value(1); // static variable calls non-static functions
      cout &lt;&lt; "foo: global_ptr is " &lt;&lt; GlobalClass::instance()-&gt;get_value() &lt;&lt; '\n';
  }
  </code></pre>
  
  <p>As I know (please correct me if I am wrong here),</p>
  
  <ol>
  <li><p>Static functions can only access(write/read) static member variables</p></li>
  <li><p>Non-Static functions can access(write/read) static member variables</p></li>
  </ol>
  
  <p>Based on above sample, it seems that a static variable can access non-static functions.<br>
  Is this correct?</p>