Guest User

Untitled

a guest
May 4th, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #define MEMBER(type, name) private: type name##_; public: void set_##name(const type& name) {name##_ = name;} const type& get_##name() {return name##_;}
  4.  
  5. class MyClass{
  6. MEMBER(int, value)
  7. };
  8.  
  9. int main()
  10. {
  11. MyClass mc;
  12. mc.set_value(5);
  13. std::cout << mc.get_value();
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment