Multiple choice

A copy constructor is invoked when

  1. a function returns by value

  2. an argument is passed by value

  3. a function calls to another function

  4. an argument is passed by reference

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

A copy constructor is invoked when an object is returned by value from a function, as a temporary object is created and copied to the caller. While passing by value also invokes a copy constructor, returning by value is a classic scenario where this occurs.