Skip to content
Quiz · Classes and OOP · lesson 3 of 15

Quiz — field initialization order

What does the program print?

C++
#include <iostream>

struct Note {
    Note(char c) { std::cout << c; }
};
struct Pair {
    Note first;
    Note second;
    Pair() : second('2'), first('1') { std::cout << '3'; }
};

int main() { Pair p; }

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way