Inherited Code Discussions | C++ | HackerRank

Inherited Code

  • + 2 comments

    I kept it as a struct, since that is what was provided. For those that may not already know, a struct is essentially the same as a class - only that it is 'public' by default, opposed to classes which are 'private' by default.

    solution

    struct BadLengthException{
        int n;
        BadLengthException(int n){
            this->n = n;
        }
        int what(){
            return n;
        }
    };