fork download
  1. #include <string>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. class Foo {
  7. public:
  8. Foo(const Foo &foo) : str(foo.str) {}
  9. Foo(string str) : str(str) {}
  10.  
  11. string str;
  12. };
  13.  
  14. void printFoo(Foo foo) {
  15. cout << foo.str << endl;
  16. }
  17.  
  18. int main() {
  19. Foo foo("qux");
  20. printFoo(foo); // OK
  21.  
  22. printFoo("qix"s);
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
qux
qix