Код: Выделить всё
class B{
public:
static int Setdec(int val, bool bGet = false) {
static int dec = 0;
if (!bGet) dec = val;
return dec;
}
static int Getdec() {
return Setdec(0, true);
}
static int dec() {
return Getdec();
}
};
int main(){
B::Setdec(10);
printf("The value of static member is %d", B::dec());
return 0;
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... -its-value
Мобильная версия