Guest User

Untitled

a guest
Jun 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. ArtCollection::ArtCollection(const ArtCollection& source)
  2. {
  3.     cout << "Copy Constructor Called" << endl;
  4.  
  5.    
  6.     size = source.size;
  7.     used = source.used;
  8.     Array = new string[source.size];
  9.  
  10.     // Use of the standard library copy function
  11.     // copy(first, last, destination)
  12.     // The first parameter holds the start address and the
  13.     // second parameter holds the address where
  14.     // the copy will end. The copy will copy all values
  15.     // from first up to but not inclusive of the value at last
  16.     // from the source to the destination. Here we only want
  17.     // to copy the rocks from the "used" portion of the container.
  18.     copy(source.Painting, source.rockHolder + used, rockHolder);
  19.  
  20.     // An alternative to the copy above would be to use a for loop.
  21.     //  for(int i = 0; i < used; i++)
  22.     //  {
  23.     //      rockHolder[i] = source.rockHolder[i];
  24.     //  }
  25.  
  26. }
Add Comment
Please, Sign In to add comment