What will be the result of the program?
#include <iostream>

class Clazz {
   int Anton;
   int Kris;
   int Denis;

   Clazz(int a)
      : Anton(++a)
      , Denis(++a)
      , Kris(++a)

int main(int argc, char *argv[]) {
   static int a;
   Clazz x(a);
   std::cout << x.Anton << x.Denis << x.Kris;
1. Static variables are always initialized with zero by default.
2. Class fields are initialized in the order of their declaration in the class code, not in the order of constructors declaration.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Зарегистрируйся сейчас
или Подпишись на будущие тесты