Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. class One;
  4. class ForTest;
  5.  
  6. class One
  7. {
  8. public:
  9.     One(ForTest *inFT) : theForTest(inFT) {};
  10.     ForTest *theForTest;
  11. };
  12.  
  13. class ForTest
  14. {
  15. public:
  16.     ForTest() : be(2), theOne(this) {};
  17.     int be;
  18.     One theOne;
  19. };
  20.  
  21. int main(void)
  22. {
  23.     printf("start\n");
  24.  
  25.     ForTest first;
  26.     first.be = 15;
  27.  
  28.     printf("fortest = %d\n", first.theOne.theForTest->be);
  29.  
  30.     printf("end\n");
  31.  
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement