Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. class Child {};
  2.  
  3. class Container
  4. {
  5. public:
  6.     Container() : field(Child())
  7.     {
  8.     }
  9.  
  10. protected:
  11.     const Child field;
  12. };
  13.  
  14. class ContainerRef
  15. {
  16. public:
  17.     ContainerRef() : field(Child())
  18.     {
  19.     }
  20.  
  21. protected:
  22.     const Child &field;
  23. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement