fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. std::string d;
  7. std::string s{"foo"};
  8.  
  9. d = s;
  10.  
  11. s.assign("bar");
  12.  
  13. std::cout << d << " " << s << std::endl;
  14. }
  15.  
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
foo bar