fork download
  1. #include <iostream>
  2. using namespace std;
  3. #include <string>
  4. class A{
  5. public:
  6. const char* what() const
  7. {
  8. string err = string("hello");
  9. return err.c_str();
  10. }
  11. };
  12. int main() {
  13. A a;
  14.  
  15. cout << a.what() << endl;
  16. return 0;
  17. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
hello