Results 1 to 2 of 2

Thread: Class copy constructor and assignment operator

  1. #1
    Geek_Guest
    Guest

    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


  2. #2
    Junior Member
    Join Date
    Dec 2007
    Answers
    1

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact