Removing static member from a header
<p>What the difference between a static member variable of a class and a "free" variable defined in the "body" of the class? I mean can I use the second in place of the first to discharge a header of the class?  </p>

<pre><code>// b.h
class B
{
public:
  B(int j);
  void print();
private:
  static int is;
};


//b.cpp
#include &lt;iostream&gt;

int i = 0;
int B::is = 0;

B::B(int j)
{
  i = j;
  is = j;
}

void B::print(){
  std::cout &lt;&lt; i &lt;&lt; " " &lt;&lt; is &lt;&lt; " " &lt;&lt; std::endl;
}

//main.cpp
int main() {
  B b1(1);
  b1.print();
  B b2(2);
  b2.print();
  b1.print();
  return 0;
}
</code></pre>

<p>output:</p>

<pre><code>1 1 
2 2 
2 2 
</code></pre>
