18.3.3 Copy Constructors (cont.)
Invoked:
- Explicitly
String first("Fred");
String second(first);
// second is initialized from first using copy
constructor
- During initialization using =
String third = first;
// Also uses copy constructor
- When an object is passed by value
- Note: Use const when
passing a reference to avoid copy overhead
prev
|top
|next