Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Why a "operator=(...)" when there is a copy ctor?

Answer Posted / guest

You use the assignment operator (operator = ()) whenever an
existing object is to be replaced with a different object.
The copy constructor X(const X&) is used to create a new
instance of an X-object exactly like another.

Notice the subtle difference. Assignment changes an existing
object while construction creates a new object. You can view
assignment as the application of a destructor, to flush away
the existing object, followed by a copy construction, to
make an exact copy of the assigned object.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you use inheritance in unity?

1025


What is the difference between a constructor and a destructor?

1174


what type of question are asked in thoughtworks pair programming round ?

2145


When not to use object oriented programming?

1020


What is object in oops?

1022


Why do we use oop?

1041


What is encapsulation example?

984


write a programe to calculate the simple intrest and compund intrest using by function overlading

2130


What is interface in oop?

1074


i am getting an of the type can not convert int to int *. to overcome this problem what we should do?

2260


How to call a non virtual function in the derived class by using base class pointer

6421


What is the difference between procedural programming and oops?

1059


write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory

3174


What do you mean by overloading?

1024


What is the point of polymorphism?

995