top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

When do you call copy constructors?

+1 vote
288 views
When do you call copy constructors?
posted Mar 18, 2015 by Jalal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

Copy constructors are called in these situations:

i.)when compiler generates a temporary object

ii.)when a function returns an object of that class by value

iii.)when the object of that class is passed by value as an argument to a function

iv.)when you construct an object based on another object of the same class

answer Mar 19, 2015 by Mohammed Hussain
...