- Erik Wikstr?mBecause you catch the exception by value, so you copy-construct a newstd::exception from the Exception that was thrown, catch the exceptionby reference instead and it will work: catch (exception& e)--Erik Wikstr?m 是的我忘了...... ..所以它打印9Exception但不是 我的msg字符串可能是我没有覆盖正确的什么()? PS 我尝试读取exception.h和exception.cpp的源代码,但在我的 gcc源代码中我找不到它! 它们在哪里?yes I''ve forgotten that...... so it print 9Exception but notmy msg string may be I didn''t override the right what() ?P.S.I try to read the source of exception.h and exception.cpp but in mygcc source I didn''t find it!where are them? 这篇关于异常和多态问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-31 19:51