title: Can non-static member function access static member function or data?
body: <p>I searched the Internet and found that some people said that non-static member function can access static member function or data. Then I wrote a program to verify it.</p>
  
  <pre><code>#include &lt;iostream&gt;
  class test
  {
  public:
      static int a;
      void printa()
      {
          std::cout&lt;&lt;a;
      }
  };
  
  int main(int argc, const char * argv[])
  {
      test m;
      m.printa();
  
      return 0;
  }
  </code></pre>
  
  <p>The code generate linker errors!</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "test::a", referenced from:
        test::printa() in main.o
  </code></pre>