I tried to bind one static constant member variable to another static constant variable in the class. The motivation is that if I need to change one value later (when encoding), I do not need to change all those that are connected to each other one at a time.
For instance:
class Box { public: Box(); private: static const double height = 10.0; static const double lid_height = 0.5 + height; };
It will not compile, and the โBox :: heightโ error cannot appear in the constant expression. "Therefore, I assume that you should enter the value of a static constant member. But is there a way to associate one member with another member variable of the same class, given that they will all be static?
source share