LogiQuest
Back to Exception Handling
10

What will be the output of the program?

#include <iostream>
using namespace std;
struct R {
    ~R() { cout << "cleanup "; }
};
int main() {
    try {
        R r;
        throw 1;
    } catch (int) {
        cout << "caught";
    }
    cout << endl;
    return 0;
}
Medium

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.