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

Can constructor be private in c++?

782


What do you mean by translation unit?

817


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

940


List the types of polymorphism in c++?

838


Do you know what are the new features that iso/ansi c++ has added to original c++ specifications?

768


What is a hashmap c++?

755


Name the operators that cannot be overloaded in C++?

786


How do you master coding?

804


Must accepts "Maestro Cards" Tax for bike should be less than 15 Total number of lanes is more than 10 Must provides monthly pass Write a method: boolean isGoodTollBridge(String[] cardsAccepted, String[] tollTax, boolean hasMonthlyPass, int numberOfLanes); String[] cardsAccepted A String array of names of card types accepted for payment of toll tax, it can be null if the toll does not accept any card String[] tollTax A String array of toll tax chart (say “Train : 300”,”BullCart : 10”) boolean hasMonthlyPass This parameter defines whether there is any monthly pass available or not int numberOfLanes This parameter defines the number of lanes for each side

3235


Define pre-condition and post-condition to a member function in c++?

881


Which c++ operator cannot overload?

740


Explain the static storage classes in c++.

920


Explain differences between new() and delete()?

818


What are single and multiple inheritances in c++?

776


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.

2214