when can we use copy constructor?

Answer Posted / richa

A copy constructor is used in 3 cases.They are listed below:
a)When an object is created from another object of the same
type.
b)When an object is passed by value as a parameter to a
function.
c)When an object is returned from a pointer.

Is This Answer Correct ?    38 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the classes in c++?

641


What is the purpose of templates in c++?

568


What is the use of volatile variable?

602


How does the copy constructor differ from the assignment operator (=)?

627


Is c++ vector a linked list?

552






Explain storage qualifiers in c++.

624


Write a program using display() function which takes two arguments.

611


find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.

2001


Can we use struct in c++?

597


How is c++ used in the real world?

575


What are the advantages of using const reference arguments in a function?

622


List the special characteristics of constructor.

734


Who created c++?

584


What is meant by entry controlled loop?

662


Define a nested class.

615