What are Copy Constructors?

Copy Constructors are constructors used to create the object of a class with another object of the class itself. If a copy constructor is not defined, the compiler generates a copy constructor that does a memeberwise copy of the class. The default copy constructor does a byte to bye copy of the class.

Person q("Mickey"); // constructor is used to build q.
Person r(p);        // copy constructor is used to build r.
Person p = q;       // copy constructor is used to initialize in declaration.


C++ FAQ Home

 
Printer friendly version of the C-Plus-Plus-FAQ-What-Are-Copy-Constructors page


Sponsored links

Software Localization Tool Sisulizer
Localize DotNet, C++ Builder, Delphi, C/C++, Visual Basic & Java apps & html help. Try Sisulizer now
CSTSOFT Instrumentation .NET & ActiveX Components
A collection of 13 instrumentation .NET/ActiveX/VCL components including Gauge,Knob,LED,Trend etc.
Web based bug tracking - AdminiTrack.com
AdminiTrack offers an effective web-based bug tracking system designed for professional software development teams.
DVD/CD Duplicators - All Free Shipping
Simple Disc-to-Disc Duplication. 2 Year Warranty & Free Shipping.
-software
-software, Try 4 Different Flavors Today, Pay Only Shipping Fee.

Advertisement



Free Magazine

Free Magazines
eWeek The essential technology information source for builders of e-business.... subscribe now

Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.