title: static counter in c++
body: <p>I'm trying to create a <code>Data</code> class whose objects each hold a unique ID.</p>
  
  <p>I want the 1st object's ID to be 1, the 2nd to be 2, etc. I must use a <code>static int</code>, but <em>all</em> the objects have the same ID, not 1, 2, 3... </p>
  
  <p>This is the <code>Data</code> class:</p>
  
  <pre><code>class Data
  {
  private:
     static int ID;
  public:
     Data(){
     ID++;
     }
  };
  </code></pre>
  
  <p>How can I do it so the first one ID would be 1, the second would be 2, etc..?</p>