What will be printed on the screen?
#include <iostream>
using namespace std;

struct A {};
struct B: A {};
struct C: B {};

int main() {
    try {
        throw new C();
    } catch(void *) {
        cout<<0;
    } catch(A*) {
        cout<<1;
    } catch(B*) {
        cout<<2;
    } catch(...) {
        cout<<3;
    }
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes