A copy constructor is used to initialize a newly declared variable from an existing variable. This makes a deep copy like assignment, but the basic difference are as follows :
- There is no need to test to see if it is being initialized from itself.
- There is no need to clean up (eg, delete) an existing value (there is none).
- A reference to itself is not returned.
No comments :
Post a Comment