Guest User

Untitled

a guest
Apr 25th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3.  
  4. class Foo
  5. {
  6. public:
  7. Foo( char const * msg ) : x( y )
  8. {
  9. y = msg;
  10. }
  11.  
  12. std::string const & x;
  13.  
  14. private:
  15. std::string y;
  16. };
  17.  
  18. int main( int argc, char * argv[] )
  19. {
  20. if ( argc >= 2 )
  21. {
  22. Foo f( argv[1] );
  23. std::cout << f.x << std::endl;
  24. }
  25. }
Add Comment
Please, Sign In to add comment