Skip to content
Quiz · Exceptions · lesson 2 of 7

Quiz — catch order

What does the program print?

C++
#include <iostream>

struct Error {};
struct NotFound : public Error {};

int main() {
    try { throw NotFound{}; }
    catch (const Error&) { std::cout << "Error"; }
    catch (const NotFound&) { std::cout << "NotFound"; }
}