#include <iostream>
using namespace std;

class foo {
	int value;
	static int static_value;
	
	public:
	
	static void set_value (void *ptr, int val) {
	  reinterpret_cast<foo*>(ptr)->value = val;
	}
	int get() const { return value; }

	static void set_static_value (void *ptr, int val) {
	  reinterpret_cast<foo*>(ptr)->static_value = val;
	  // объект излишен, т.к. меняем статический член
	  // достаточно static_value = val;
	}
	static int get_static() { return static_value; }

};

int foo::static_value;

int main() {
	
	foo bar;
	foo::set_value (&bar, 123);
	cout << bar.get();

	foo::set_static_value (&bar, 456);
	cout << bar.get_static();
	
	return 0;
}