Difference between copy constructor and assignment operator?

[Edit]

The copy constructor is used to initialize a new instance from an old
instance, and is called when passing variables by value into functions
or as return values out of functions.
The assignment operator is used to change an existing instance to have
the same values as the rvalue, which means that the instance has to be
destroyed and re-initialized if it has internal dynamic memory.

Improve Answer Discuss the question "Difference between copy constructor and assignment operator?" Watch Question

First answer by ID3343092378. Last edit by ID3343092378. Question popularity: 12 [recommend question]

Research your answer:

Answers.com > Wiki Answers > Categories > Technology > Computers > Computer Programming > Difference between copy constructor and assignment operator?

Our contributors said this page should be displayed for the questions below. (Where do these come from)
If any of these are not a genuine rephrasing of the question, please help out and edit these alternates.
What is virtual constructor?  When to use copy constructor?  What is a assignment operator?  Difference btw new and operator new?  Difference between assignment and copy constructor?  Difference copy constructor and assignment operator?  What should be the return type of assignment operator?  What is difference between copy constructor and constructor?  Is the copy constructor accepts the reference as a parameter?  What is difference between copy constructor and assignment operator?