Advertisement
teknoraver

private

Mar 16th, 2019
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <cstdio>
  2.  
  3. class myclass {
  4. private:
  5.     int secret;
  6.  
  7. public:
  8.     myclass(int i) : secret(i * 7) { }
  9. };
  10.  
  11. struct myclone {
  12.     int secret;
  13. };
  14.  
  15.  
  16. int main(int argc, char *argv[])
  17. {
  18.     myclass mc(3);
  19.     struct myclone *cl = (struct myclone *)&mc;
  20.  
  21.     printf("%d\n", cl->secret);
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement