I have a code like this:
class MyClass
{
private:
static const int intvalue= 50;
static const float floatvalue = 0.07f;
};
in Visual studio 2010 and I am getting this error:
Myclasses.h(86): error C2864: 'MyClass::floatvalue : only static const integral data members can be initialized within a class
So how to initialize a static constant float in c++?
If I use constructor, every time that an object of this class is created, the variable is initialized which is not good.
apparently the code is compiled with GCC on Linux.