#include <iostream>
namespace One {
namespace Two {
class ExampleClass {
public:
// static members can be accessed without a class being instantiated
static int i;
};
}
}
// they also need to be defined outside the class
int One::Two::ExampleClass::i = 500;
int main()
{
std::cout << One::Two::ExampleClass::i << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKbmFtZXNwYWNlIE9uZSB7Cm5hbWVzcGFjZSBUd28gewoKY2xhc3MgRXhhbXBsZUNsYXNzIHsKcHVibGljOgoKICAgIC8vIHN0YXRpYyBtZW1iZXJzIGNhbiBiZSBhY2Nlc3NlZCB3aXRob3V0IGEgY2xhc3MgYmVpbmcgaW5zdGFudGlhdGVkCglzdGF0aWMgaW50IGk7Cn07Cgp9Cn0KCi8vIHRoZXkgYWxzbyBuZWVkIHRvIGJlIGRlZmluZWQgb3V0c2lkZSB0aGUgY2xhc3MKaW50IE9uZTo6VHdvOjpFeGFtcGxlQ2xhc3M6OmkgPSA1MDA7CgppbnQgbWFpbigpCnsKCXN0ZDo6Y291dCA8PCBPbmU6OlR3bzo6RXhhbXBsZUNsYXNzOjppIDw8IHN0ZDo6ZW5kbDsKfQo=