5
私はC++をかなり新しくしており、std :: exceptionから拡張されたカスタム例外の次のコードスニペットが見つかりました。私が理解できない部分は、コンストラクタ定義の後の: err_msg(msg) {}
です。なぜこれが関数の中括弧にないのか説明できますか?カスタム例外クラスのC++構文
class my_exception : public std::exception {
private:
std::string err_msg;
public:
my_exception(const char *msg) : err_msg(msg) {};
~my_exception() throw() {};
const char *what() const throw() { return this->err_msg.c_str(); };
};