This preview shows page 1. Sign up to view the full content.
Unformatted text preview: is that the copy is made to a
new memory location.
A copy constructor iis the class function used by
C++ in cases other than assignment.
C++ Applied Programming It looks the same as the previous constructors
except that it has an argument of reference type
of the class.
It must perform all the usual tasks that a
constructor does (allocate memory, initialise) but
also must transfer the values of its argument to
the class instance.
the class aClass
// default constructor
// standard constructor
// copy constructor
W e'll see the use of the copy constructor later.
We'll So let's look at the complete set.
Applied Programming Here's TimeType's.
hours = otherTime.hours;
minutes = otherTime.minutes;
seconds = otherTime.seconds;
} Applied Programming Let'...
View Full Document
This document was uploaded on 04/07/2014.
- Spring '14