C++ Initialize class static data member
<p>I have a class which has a number of static function to perform some calculation. However, before the calculation, I need to pass in a data to initialize some of the static data members. Currently I have an init(data) function and a clearResource() function which should be called before and after the use of the class. Is there a better way of doing that?</p>

<p>For example:</p>

<pre><code>classA(){
 static int a;
 static init(int b) {
    a = b;
 }
 static functionA(){
   //perform something based on value of a;
    switch(a){
    }
 }

}

int main(){
  classA::init(5);
  classA::functionA();
 }
</code></pre>

<p>Thanks</p>
