This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | Next revision Both sides next revision | ||
|
cpp:exception_inheritance [2019/05/06 08:11] gthanos |
cpp:exception_inheritance [2020/05/04 12:04] gthanos |
||
|---|---|---|---|
| Line 6: | Line 6: | ||
| using namespace std; | using namespace std; | ||
| - | class BaseException: public std:: | + | class BaseException { |
| protected: | protected: | ||
| int a; | int a; | ||
| Line 12: | Line 12: | ||
| public: | public: | ||
| BaseException(int a) { this->a = a; } | BaseException(int a) { this->a = a; } | ||
| - | | + | |
| sprintf(s, " | sprintf(s, " | ||
| return s; | return s; | ||
| Line 27: | Line 27: | ||
| public: | public: | ||
| DerivedException(int a, int b): BaseException(a) { this->b = b; } | DerivedException(int a, int b): BaseException(a) { this->b = b; } | ||
| - | | + | char* message() { |
| sprintf(s, " | sprintf(s, " | ||
| return s; | return s; | ||