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...

when can we use copy constructor?

Answer Posted / amar

Copy constructors is used in following cases.
1) When object is passed by values to a fucntion
2) when function returns object by value
3) When new object is created from exixting object using
overlaoded = operator.

If user has not defined its own copy constructor, compiler
synthesised constructor would be called which will do
shallow copy. So if you have pointer in your class then only
the pointer value is copied and not the contents which
pointer points to.

Is This Answer Correct ?    12 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is flush programming?

1012


Explain the difference between using macro and inline functions?

1124


What is the size of integer variable?

1055


Do the parentheses after the type name make a difference with new?

1081


Is c++ low level?

1030


Write a program to find the reverse Fibonacci series starting from N.

1266


What are c++ manipulators?

1072


You want to link a c++ program to c functions. How would you do it?

991


When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?

1092


What does obj stand for?

1158


What happens when the extern "c" char func (char*,waste) executes?

1085


Explain the volatile and mutable keywords.

1066


Differentiate between late binding and early binding.

1272


Are c and c++ different?

977


What do manipulators do?

1009