Hi, I just reached the classes chapter in my C++ book, and I'm shocked that I can't declare static double constants in a class.
In java, i used the following everywhere...
class A
{
final static double FACTOR = 12.35;
final static int INT_FACTOR = (int)(FACTOR*100);
final static int[] array = new int[INT_FACTOR];
}
How can I make an equivalent thing in C++?
class A
{
static const double FACTOR = 12.35; //not allowed
static const int INT_FACTOR = 1235; //but this is!?
static const int array[INT_FACTOR];
}
Thanks a lot for your help. Honestly, I have to say that I don't like C++ very much, it seems quite inconsistent at times... Alas, the power of pointers comes at a heavy price.
-Cuppo