#include <iostream> using namespace std; class A { public: A(int a, int b) { this->a = a; this->b = b; cout << "我是快乐的构造函数。\n"; } ~A() { cout << "我是无能的析构函数\n"; } protected: private: int a; int b; }; void divide() { A a1(2, 4), a2(2, 6); throw 3; } int main() { try { divide(); } catch(...) { } system("pause"); }
这里的throw 3 为什么会引发异常?
时间: 2024-09-29 09:25:34