When copy constructor can be used?

Answer Posted / sachin magdum

1. "assigning" - don't use this word, it should be
initializing an object using another object of same type
2. When the object is passed to function - "by value"
3. when a function returns the object type - "by value"
here doesn't matter if you are assigning that returned
value to to another object or not.

Is This Answer Correct ?    9 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of scopes are there in c++?

580


What is a stack? How it can be implemented?

700


Which is the best c++ compiler?

597


Why are pointers used?

582


Perform addition, multiplication, subtraction of 2-D array using Operator Overloading.

3375






What are the advantages of using typedef in a program?

643


why is c++ called oops? Explain

584


Describe friend function & its advantages.

717


What is the difference between structures and unions?

585


What is a class definition?

615


Refer to a name of class or function that is defined within a namespace?

617


Arrange Doubly linked list in the ascending order of its integral value and replace integer 5 with 7?

3705


How many characters are recognized by ANSI C++?

901


What is else if syntax?

681


what Is DCS ? what i will get benefit when i did?

1838