class TConst
{
const int i;
int& ref;
public:
TConst(int n):i(n),ref(n){}
static void p1(){prn(i);}//error here
};
My compiler generates an error when I try to use a const
class member in a static
member-function.
Why is it not allowed?
static const int i = 42;
if you want to use it this way.