#define PROPERTY_RW(T,var) public: \
void set_##var(const T& _var){m_##var=_var;}\
T get_##var(){return m_##var;}\
private: T m_##var;
class Test
{
public:
Test();
~Test();
PROPERTY_RW(int, my_var)
private:
};
Test::Test()
{
}
Test::~Test()
{
}
int main()
{
Test t;
t.set_my_var(1000);
auto x=t.get_my_var();
printf("var=%d\n", x);
getchar();
return 0;
}