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

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

void Test() {
  A a1 = A(), *a2(), &a3(a1);
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.

Follow CodeGalaxy

Mobile Beta

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