CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C++ DETAILS
Question :
what are the disadvantages of copy constructor??
Contact   Contact
Category C++ Interview Questions
Rating (4.7) By 34 users
Added on 8/16/2007 10:35:31 AM
Views 5685
Rate it!
Answers:

Well if we are talking about the default copy constructor, then the disadvantage it suffers from is that i does a shallow copy of the class object.
Which means that if the class has some dynamic memory allocated or file pointers, the copied object will also point to the same memory location or files. That is the memory or file is not copied.



 Posted by: Samit Sasan    

Contact Samit Sasan  Contact Samit Sasan

If the programer is defining the copy constructor, the compiler will invoke the copy constructor at the time of copying the members of the calling object to the members of the called objects. This will cretaes the problems if the object contains the pointer variables. The time copying is more if there are more number of object memebrs



 Posted by: mahendra    

Contact mahendra  Contact mahendra


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
What Is The Use of VirtualDestructer?
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C++ Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/11681/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.84