Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. struct new_cls {
  2. public:
  3. char &get_hidden_c() {return c;}
  4. double &get_hidden_d() {return d;}
  5. int &get_hidden_i() {return i;}
  6. private:
  7. char c;
  8. double d;
  9. int i;
  10. };
  11.  
  12. char &get_c(Cls &cls) {
  13. new_cls * newcls= (new_cls *) & cls;
  14. return newcls->get_hidden_c();
  15. }
  16.  
  17. double &get_d(Cls &cls) {
  18. new_cls * newcls = (new_cls *) & cls;
  19. return newcls->get_hidden_d();
  20. }
  21.  
  22. int &get_i(Cls &cls) {
  23. new_cls * newcls = (new_cls *) & cls;
  24. return newcls->get_hidden_i();
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement