I created this constructor and I need to make a deep copy of it. I do not quite understand the meaning of the deep copy. I know that he makes an independent copy of an object that has its own dynamic memory, but I do not understand what is needed for this. I am also not sure how to implement a deep copy. Any suggestions?
Here is my constructor that I need to make a deep copy: Can someone provide some syntactic help, like a skeleton?
template<class t_type>
inline ALIST<t_type>::ALIST()
{
t_type value;
capacity=10;
DB = new t_type[capacity];
count=capacity;
cout<<"Enter value: ";
cin.clear();
cin>>value;
for(int i=0; i<capacity; i++)
{
DB[i]=value;
}
}
source
share