Q:

When are copy constructors called in C++?

0

When are copy constructors called in C++?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

There are some possible situations when copy constructor is called in C++,

  • When an object of the class is returned by value.
  • When an object of the class is passed (to a function) by value as an argument.
  • When an object is constructed based on another object of the same class.
  • When the compiler generates a temporary object.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Interview Questions For Experienced

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Why copy constructor take the parameter as a refer... >>
<< What is a copy constructor in c++?...