Inherited Code Discussions | C++ | HackerRank

Inherited Code

  • + 0 comments

    If showing error in integer or const something stuffs, just remove the 'const' keyword after as : class BadLengthException : public exception { private: int exceptionname; public: explicit BadLengthException(const int &exceptionexample) { exceptionname = exceptionexample;}

    int what()    // removing 'const' after 'what()' works , not any other
    {       
        return exceptionname;
    }