C宏定义不清楚
发布时间:2020-12-16 10:16:58 所属栏目:百科 来源:网络整理
导读:这是一个类的宏定义还是它究竟是什么? #define EXCEPTIONCLASS_IMPLEMENTATION(name,base,string) : public base { public: name() : base(string) {} name(const x::wrap_exc next) : base(string,next) {}; name(const x::wrap_exc prev,const x
这是一个类的宏定义还是它究竟是什么?
#define EXCEPTIONCLASS_IMPLEMENTATION(name,base,string) : public base { public: name() : base(string) {} name(const x::wrap_exc& next) : base(string,next) {}; name(const x::wrap_exc& prev,const x::wrap_exc& next) : base(prev,next) {}; } 解决方法
它是异常类的宏定义.
看起来有人要你写这样的代码: class my_exception EXCEPTIONCLASS_IMPLEMENTATION(my_exception,std::exception,"What a mess!") 预处理器将吐出: class my_exception : public std::exception { public: my_exception() : std::exception("What a mess!") {} my_exception(const x::wrap_exc& next) : std::exception("What a mess!",next) {}; my_exception(const x::wrap_exc& prev,const x::wrap_exc& next) : std::exception(prev,next) {}; }
这是令人厌恶的! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |