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

What is c++ prototype?

589


Explain the different access specifiers for the class member in c++.

548


Why c++ is created?

576


How the programmer of a class should decide whether to declare member function or a friend function?

684


What is a stack? How it can be implemented?

696






Which software is used to run c++ program?

554


How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?

646


Please explain the reference variable in c++?

618


What's the "software peter principleā€?

624


What is else syntax in c++?

642


what is a class? Explain with an example.

621


which operator is used for performing an exponential operation a) > b) ^ c) none

607


We use library functions in the program, in what form they are provided to the program?

601


Is turbo c++ free?

621


What are the advantages of using a pointer? Define the operators that can be used with a pointer.

606