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?

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / arun

Copy Constructor means creation of new object and after that
copy properties of some exiting object to newly created object.

Overloading assignment operator is that copy properties of
some exiting object to another exiting object of same type.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More OOPS Interview Questions

What is the difference between declaration and definition?

20 Answers   IBS,


what is the virtual function overhead, and what is it used for ? i hope i can get and appropriate answers, thanks a lot....

6 Answers  


Is oop better than procedural?

0 Answers  


Why polymorphism is used in oops?

0 Answers  


Generally, in all C++ programs, texts are in white colour. Can we change the colour of the text(either input or output or both)? If so, help me out.

1 Answers  


How does polymorphism work?

0 Answers  


Can we have a private virtual method ?

8 Answers   Ness Technologies,


Is react oop?

0 Answers  


What is polymorphism oop?

0 Answers  


What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 2) 17 3) 16.5

16 Answers   TCS,


define oops concept with example

1 Answers   Cap Gemini,


1.what are two type of classe members called? 2.what is data hiding and data encapsulation? 3.how do you make a class member visible aouside its class? 4.what is the default visibility of a class data member? 5.what are the advantages of oop over the structured programing?

6 Answers  


Categories