when can we use copy constructor?

Answer Posted / praveen

A copy constructor is used in the following cases.
* When compiler generates a temporary object.
* When an object is return type of pointer.
* This is a temporary object.

Is This Answer Correct ?    2 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use classes in c++?

581


What is flush () in c++?

580


What is a local reference?

675


What is the default access level?

629


Explain the difference between overloading and overriding?

616






What is an undefined reference/unresolved external symbol error and how do I fix it?

606


If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?

612


Why do we need pointers?

585


Can I learn c++ without knowing c?

595


What do you mean by “this” pointer?

619


What is a class template?

593


What is runtime polymorphism in c++?

595


Will the following program execute?

563


Does c++ have arraylist?

544


What number of digits that can be accuratly stored in a float (based on the IEEE Standard 754)? a) 6 b) 38 c) An unlimited number

791