21 lines
530 B
C++
21 lines
530 B
C++
#ifndef EXCEPTION_H
|
|
#define EXCEPTION_H
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
/* `explicit` specifier forces constructors to not being implicitly called */
|
|
class Ex {
|
|
private:
|
|
std::string msg;
|
|
public:
|
|
explicit Ex();
|
|
explicit Ex(const char* msg);
|
|
explicit Ex(const std::string& msg);
|
|
friend std::ostream& operator<<(std::ostream&, const Ex&);
|
|
};
|
|
|
|
/* Parent::Parent makes classes inherit their constructors from parents (C++11) */
|
|
class ExPCSC : public Ex { using Ex::Ex; };
|
|
|
|
#endif |