Advertisement
tinyevil

Untitled

Jul 21st, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. /*
  2. 1. Isolated name spaces
  3. */
  4.  
  5. // no name conflict
  6. namespace foo{
  7.     struct Foo{
  8.         ...
  9.     }
  10. }
  11. namespace bar{
  12.     struct Foo{
  13.         ...
  14.     }
  15. }
  16.  
  17.  
  18. /*
  19. 2. Hide rarely used stuff
  20. */
  21. namespace helpers{
  22.     function i_am_rarely_used();
  23.     struct Utility{
  24.     }  
  25.     function work_with_utility();
  26. }
  27.  
  28. struct MyType{
  29. }
  30.  
  31. function do_something_with_mytype();
  32.  
  33.  
  34. /*
  35. 3. Re-export stuff from other units/namespaces
  36. */
  37. namespace facade{
  38.     public import math_functions_1;
  39.     public import math_functions_2;
  40.     ...
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement