由于 VS2008 类 bad_alloc 不提供带有字符串参数的构造函数。有没有可能在不覆盖这样的类的情况下创建自定义消息?
// this is only pseudo-code
class custom_exception : bad_alloc {
public:
string Message;
custom_exception(string m) {Message = m;}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1559 次 |
| 最近记录: |