I need to set the value of static float variable during run time but I am unable to do that.
I will provide example to elaborate my situation
afile.h
class B {
static float variable1;
static float variable2;
public:
afunction(float a, float b);
}
afile.cpp
#include 'afile.h'
B::afunction (float a, float b) {
float B:variable1 = a;
float B:variable2 = b;
}
As you see in the code above the function ‘afunction’ is called and then the variables ‘variable1’ and ‘variable2’ has to be set. I know the code in definition of ‘afunction’ is wrong however I need a way to set value of variable1 and variable2 during run time.
If it is relevant to my code, I am using Visual Studio 6.0 to develop the application
Just write:
That should work.