Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Class copy constructor and assignment operator

This is a discussion on Class copy constructor and assignment operator within the C and C++ forums, part of the Software Development category; Explain why it is essential that a class that dynamically allocate memory in the constructor also needs a properly written copy constructor and assignment operator. Is the above question related ...

Go Back   Geeks Talk > Software Development > C and C++
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 09-11-2007
Expert Member
 
Join Date: Feb 2007
Posts: 1,279
Thanks: 0
Thanked 192 Times in 154 Posts
Geek_Guest has a spectacular aura aboutGeek_Guest has a spectacular aura aboutGeek_Guest has a spectacular aura about
Class copy constructor and assignment operator

Explain why it is essential that a class that dynamically allocate memory in the constructor also needs a properly written copy constructor and assignment operator.

Is the above question related to memory leaks? How would we know if we have 'improperly' written the copy constructor and assignment operator? What are the pre-emptive measures?

"What are the two ways of achieving automatic type conversion from an object of class X into an object of class Y?"

Thanks.

Question asked by visitor Yves
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-21-2007
Junior Member
 
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
cpchawla is on a distinguished road
Re: Class copy constructor and assignment operator

Hi,
class that dynamically allocate memory in the constructor also needs a properly written copy constructor and assignment operator.
This is related to Memory Problem.
Its Resolved the wild pointer problem when u create new Class pointer and Initialize it with existing class pointer through assignment operator.
Reply With Quote
Reply

  Geeks Talk > Software Development > C and C++

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
constructor emb.mallik C and C++ 1 03-02-2009 04:50 PM
why i am getting an error while calling a constructor from another constructor raj_java_j2ee Java 4 07-22-2007 03:39 AM
Silent Copy - copy your files with the convenience! JobHelper Geeks Lounge 0 04-05-2007 04:40 AM
Operator Overloading sripri C and C++ 2 12-11-2006 10:12 AM
Default and Automatic account assignment Lokesh M SAP R/3 0 12-08-2006 05:37 AM


All times are GMT -4. The time now is 09:29 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved