[1] compiles while [2] does not because only (hope I'm saying this right) static const integral data members can be initialized in a class. I was reading a thread a few days ago where it was said - if memory serves - C++Ox (some version of GCC is already doing this) will recognize [2]. The question: Why is [1] allowed to compile while [2] doesnt? The fact that one is a class and the other is not doesnt seem like a good answer to me.Code:// header file called .. test.h [1] static const double dval ( 3.1233 ); // in a source file called main.cpp [2] class bar { static const double dbar_val ; public : bar () {} }; double bar::dbar_val = 3.1233;




Reply With Quote