Copy and Move Constructors
In this lesson, you will learn about two types of constructors: copy and move.
We'll cover the following...
We'll cover the following...
Copy constructor
A copy constructor is a special member function with the following signature:
ClassName(const ClassName&);
It’s used when you create an object using a variable of the same type. For example:
Experiment exp { 42, 100 };
Experiment other { exp }; // copy constructor called!
Implementing a copy constructor might be necessary when your class has data members that cannot be shallow copied, like ...