How to : Static variable in inherited class
<pre><code>class B {
 public:
   static int a;
};
class C:B {
};
</code></pre>

<p>I want to use a variable through any inherited classes but it has problem when I declare a.</p>

<pre><code>B::B() {
  a=1;
};
</code></pre>

<p>Do I do it right ?<br>
Thanks for reading and waiting for your comments.</p>

<p>// I miss semicolons which is not the error I'm talking .
// This is an error when I try to delcare 
class GameState {
  public:
    static int a = 1;
 //...
};</p>

<pre><code>Error   7   error C2864: 'CGameState::a' : only static const integral data members can be initialized within a class    d:\my dropbox\work\#today\gdimario\gdimario\gamestate.h 18
</code></pre>

<p>I try to write a simple question which shows the problem I want instead of pasting my whole code.</p>
