What will be printed as a result of executing the Test() function?
#include <iostream>

class A {
public:
  A() { std::cout << "A()"; }
};

void Test() {
  A a1 = A(), *a2(), &a3(a1);
}
Explanation
The constructor will be called only when initializing a1. a2 is a function that does not accept the input parameters and returns a pointer to A. a3 is a reference to a1.

Следи за CodeGalaxy

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

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