Advertisement
Guest User

Untitled

a guest
Apr 13th, 2023
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. //============= file A.h =============
  2. #pragma once
  3.  
  4. class B;
  5.  
  6. // Make sure A is fully declared but no implementations are defined yet
  7. class A
  8. {
  9. B createB();
  10. }
  11.  
  12. #include "B.h"
  13.  
  14. A::createB() { return B{}; } // Implementations MUST come after header include
  15.  
  16.  
  17. //============= file B.h =============
  18. #pragma once
  19.  
  20. class A;
  21.  
  22. class B
  23. {
  24. A createA();
  25. }
  26.  
  27. #include "A.h"
  28.  
  29. B::createA() { return A{}; }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement