when can we use copy constructor?

Answer Posted / sagarson

Copy constructors are called in following cases:
a) when a function returns an object of that class by value
b) when the object of that class is passed by value as an
argument to a function
c) when you construct an object based on another object of
the same class
d) When compiler generates a temporary object

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is code reusability in c++?

658


In int main(int argc, char *argv[]) what is argv[0] a) The first argument passed into the program b) The program name c) You can't define main like that

606


Write about c++ storage classes?

736


Where do I find the current c or c++ standard documents?

573


What is a driver program?

621






What is the best book for c++ beginners?

562


Can you pass an array to a function in c++?

529


How do you clear a map in c++?

561


How do c++ struct differs from the c++ class?

581


What is c++ manipulator?

545


What is c++ array?

541


Is it possible to have a recursive inline function in c++?

538


What is the use of "new" operator?

649


What is a storage class? Mention the storage classes in c++.

584


What is the maximum combined length of command line arguments including the space between adjacent arguments?

586