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

class type to basic type conversion

2408


Which type does string inherit from?

1106


design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)

6678


What is protected in oop?

1072


Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.

2195


Why is static class not inherited?

1108


Why do we use inheritance?

1118


What is encapsulation in ict?

1060


What are the two different types of polymorphism?

1143


What is the purpose of polymorphism?

1125


What is the problem with multiple inheritance?

1167


How do you define social class?

1063


What is polymorphism programming?

1130


Who invented oop?

1132


• What are the desirable attributes for memory managment?

2233