fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main()
  5. {
  6. {
  7. std::string (&plus)(std::string const&, std::string const&) = &std::operator+;
  8. std::string a ("Hello, "), b("World!");
  9. std::cout << plus(a, b) << std::endl;
  10. }
  11.  
  12. {
  13. int (&plus)(int const&, int const&) = &operator+;
  14. int a (3), b(4);
  15. std::cout << plus(a, b) << std::endl;
  16. }
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:13:56: error: ‘operator+’ not defined
stdout
Standard output is empty