Advertisement
tinyevil

Untitled

Feb 18th, 2019
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. namespace test {
  2.  
  3. // visible to everyone who can refer to test
  4. public struct Foo {}
  5.  
  6. // only visibile to someone within test (children namespaces included)
  7. private struct Bar {}
  8.  
  9. // custom visibility scope
  10. public scope myscope;
  11.  
  12. // visible to everyone who can name both myscope and test
  13. struct myscope::Mix {}
  14.  
  15. }
  16.  
  17. // so, in a different namespace...
  18.  
  19. namespace other {
  20. test.Foo; // ok
  21. test.Bar; // not ok
  22. test.Mix; // not ok
  23. test.(test.myscope::Mix); // ok, but ugly
  24.  
  25. use scope test.myscope;
  26. test.Mix; // now its ok
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement