C++ Constructors Question: Download C++ Constructors PDF

Can you please explain the difference between copy constructor and an assignment operator?

Tweet Share WhatsApp

Answer:

A copy constructor is used to declare and initialize an object from another object.
E.g: integer I2(I1);

An assignment operator doesnot invoke the copy constructor. It simply assigns the values of an object to another, member by member.

Download C++ Constructors PDF Read All 51 C++ Constructors Questions
Previous QuestionNext Question
What is virtual destructor and how to use it?What is shallow?