Show activity on this post. int main() int *a; a=new int[4]; for(int i=0;i<5;i++){ a[i]=i; cout<<a[i]<<endl; } Array array1(a);//Constructor invoked array1. Print(); Array another=array1;//copy constructor invoked another. Print();
Read moreHow do I copy an entire array in C++?
Copy an Array in C++
Read moreWhat are copy constructors in C++?
The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously . The copy constructor is used to − Initialize one object from another of the same type. Copy an object to pass it as an argument to a function.
Read more