Inherited Code Discussions | C++ | HackerRank

Inherited Code

  • + 0 comments

    C++14 per API that derives from std::exception instead of a free-floating class/struct.

    class BadLengthException : exception {
    public:
        BadLengthException( int length ) : message_(to_string(length)) {}
        const char* what() const noexcept override { return message_.c_str(); }
    private:
        string message_;
    };