This is known as Copy initialization.
Copy Initialization is defined as:
T t2 = t1;
Depending on type of t1
two scenarios are possible:
If t1
is NOT of the type T
:
- It tries to convert
t1
to type T
by using a implicit conversion sequence and
- then copies the created object in to
t2
by calling the copy constructor.
If t1
is of the type T
:
- It copies
t1
in to t2
by calling the copy constructor.
Note though that the copy constructor call might be elided through copy elision.
There is no assignment involved here. Assignment only occurs when you assign an already constructed object to another. Your code statement involves construction as well as value assigning in one single statement so there is no Assignment per se.