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 is the benefit of c++?

588


what you know about c++?

652


How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?

3193


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create

2059


Is c# written in c++?

510






Why is it necessary to use a reference in the argument to the copy constructor?

623


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.

1986


Would you rather wait for quicksort, linear search, or bubble sort on a 200000 element array? (Or go to lunch...) a) Quicksort b) Linear Search c) Bubble Sort

624


int age=35; if(age>80) {Console.WriteLine("Boy you are old");} else {Console.WrieLine("That is a good age");}

819


Do you know what is overriding?

608


Evaluate !(1&&1||1&&0) a) Error b) False c) True

690


What is main function in c++ with example?

549


List the merits and demerits of declaring a nested class in C++?

595


Can a program run without main?

617


How is modularity introduced in C++?

759