fork download
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. class MathException : std::exception
  6. {
  7. public:
  8. MathException(std::string &&whatStr) noexcept : whatStr(std::move(whatStr)) { }
  9. MathException(const std::string &whatStr) noexcept : whatStr(whatStr) { }
  10. ~MathException() noexcept;
  11.  
  12. const char* what() const noexcept override;
  13.  
  14. private:
  15. std::string whatStr;
  16. };
  17.  
  18. const char* MathException::what() const noexcept
  19. {
  20. return whatStr.c_str();
  21. }
  22.  
  23.  
  24.  
  25. int main()
  26. {
  27. }
  28.  
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
Standard output is empty