Copy Constructor
Compiler-Provided Copy Constructor
If we don’t provide an implementation of the copy constructor, the compiler provides a Copy Constructor that simply copies all the fields.
Another example:
Why
*this
and not justthis
?Because
*this
is a pointer. And this makes sense on why you would dothis->data
instead ofthis.data
when you want to access specific member fields!
Note about this, it might be dangerous to get confused on. This is actually super important!