Copy Constructor Quiz-Asked in Interviews.

Placewit
Feb 11, 2022

--

When is a Copy constructor is invoked?

A) Instance of a class is Created

B) Argument is passed by reference

C) Argument is passed by reference

D) Function returns by value

Solution: D is correct

In C++, a Copy Constructor may be called for the following cases:1) When an object of the class is returned by value. 
2) When an object of the class is passed (to a function) by value as an argument.
3) When an object is constructed based on another object of the same class.
4) When the compiler generates a temporary object.

Thanks for Reading

Placewit grows the best engineers by providing an interactive classroom experience and by helping them develop their skills and get placed in amazing companies.

Learn more at Placewit. Follow us on Instagram and Facebook for daily learning.

--

--

Placewit
Placewit

Written by Placewit

Upskilling students for tech placements!

No responses yet