title: Static Class Data Members and Constructors
body: <p>How do I access a static member in a class with all static methods?</p>
  
  <p>I want to have a group of related functions but also have some important data members initialized before any of these functions are called. I thought a class with only static members would be the way to go. Compiler in VS2008 doesn't like me trying to access "a". </p>
  
  <p>Surely I'm missing something small but still very confused. :P
  (Even without the invalid access of "a" the constructor isn't called when calling testMethod() from main.</p>
  
  <pre><code>class IPAddressResolver
  {
  private:
  
  public:
      static int a;
      IPAddressResolver();
      static void TestMethod();
  };
  
  
  IPAddressResolver::IPAddressResolver()
  {
      IPAddressResolver::a = 0;
      cout &lt;&lt; "Creating IPAddressResolver" &lt;&lt; endl;
  }
  
  void IPAddressResolver::TestMethod()
  {
      cout &lt;&lt; "testMethod" &lt;&lt; endl;
  }
  </code></pre>