Inherited Code Discussions | C++ | HackerRank

Inherited Code

  • + 0 comments
    class BadLengthException : public exception 
    {
    private:
        string message;
    public:
        explicit BadLengthException(int n) 
            : message(to_string(n)) {}
        
        const char* what() const noexcept override {
            return message.c_str();
        }
    };