which are performed of basic data types like int , float ,char ,long etc .but copy constructor -> this can be used to assign a object of deriver data type . Folks,Copy constructor creates / has the instance (c. Diffrence between a "assignment operator" and a "copy constructor" assignment operator -> which are performed of basic data types like int , float ,char ,long etc .but copy constructor -> this can be used to assign a object of deriver data type . Folks,Copy constructor creates / has the instance (c . 4 members have posted answers.">
RE:
Diffrence between a "assignment operator" and a "copy constructor"
assignment operator -> which are performed of basic data types like int float char long etc . but copy constructor -> this can be used to assign a object of deriver data type .
RE:
Diffrence between a "assignment operator" and a "copy constructor"
Folks Copy constructor creates / has the instance (constructor). But for operator the you need a instance which is created either by default constructor or normal constructor.thanksSrini
RE: Diffrence between a "assignment operator" and a "...
Assignment changed the value of the object that has already been constructed. But copy constructor construct a NEW object and gives it a value at the same time.
RE: Diffrence between a "assignment operator" and a "copy constructor"
In C++ assignment and copy construction are different because the copy constructor initializes uninitialized memory whereas assignment starts with an existing initialized object. If your class contains instances of other classes as data members the copy constructor must first construct these data members before it calls operator . The result is that these members get initialized twice. It's the same thing that happens with the default constructor when you initialize members using assignment instead of initializers.