본문 바로가기
C++

[HackerRank] Inherited Code - Easy

by 호아나트 2019. 10. 25.
반응형

https://www.hackerrank.com/challenges/inherited-code/problem

 

Inherited Code | HackerRank

Handle errors that can occur in the existing code.

www.hackerrank.com

/* Define the exception here */
class BadLengthException
{
private:
int nameLength;
public:
BadLengthException(int n) : nameLength(n)
{}
virtual int what() const
{
    return nameLength;
}

};
반응형

'C++' 카테고리의 다른 글

[HackerRank] Virtual Functions -Medium  (0) 2019.10.28
[HackerRank] Exceptional Server - Easy  (0) 2019.10.25
[HackerRank] Box it! - easy  (0) 2019.10.23
[HackerRank] Classes and Objects - Easy  (0) 2019.10.16
[HackerRank] Strings - Easy  (0) 2019.10.14

댓글