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

Difference between overloaded functions and overridden functions

592


Is the declaration of a class its interface or its implementation?

714


What is a tree in c++?

567


Why is null pointer used?

698


Explain the extern storage classes in c++.

566






Why is the function main() special?

634


Write about the access privileges in c++ and also mention about its default access level?

623


How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?

650


How delete [] is different from delete?

609


What does flush do c++?

574


What is virtual function? Explain with an example

601


Can we run c program in turbo c++?

596


Can you be bale to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?

571


Explain about vectors in c ++?

607


What is the difference between C and CPP?

637