#include <exception>
#include <iostream>
using namespace std;
class A
{
public:
A(int n) : i(n) { cout << i; }
~A() { cout << i; }
private:
int i;
};
int f(int n)
{
if (n == 1) {
throw std::logic_error("0");
cout << "7" << endl;
}
A a(n);
return f(n - 1);
}
int main() //main function
{
try {
int ret = f(3);
A a(ret);
}
catch (const std::exception &e) {
cout << e.what() << endl;
}
return 0;
}
Why the output of this c++ in exceptional handling is 32230 ? I am little bit confused.
I am using ATOM for programming Thanks