-3

I don't know a question for my C++ course.

template <typename T> class Array {...};
void main(int argc, char* argv[]) {

Array<int> *a1 = new Array<int>();
Array<int> a2();
a2 = *a1; // <--  
}

What will happen at the noted line (<--)? a) a2 copy constructor is called. b) The address of a2 becomes equal to the address of pointer a1. c) copy assignment operator of a2 is called d) compilation error

Justify your answer.

1 Answers1

1

d) compilation error as you have vexing parse:

Array<int> a2(); // Declaration of function which takes no argument and return Array<int>
Jarod42
  • 203,559
  • 14
  • 181
  • 302