+ 1
Why base copy constructor is called
Refer code below: https://www.sololearn.com/compiler-playground/c4C8KhE4ef5a I am typecasting object from derived class to base class. As it has to slice object and create the base object , why copy constructor of base class is called instead of move constructor? Object is temporary so it should call move constructor, right?
3 ответов
+ 2
The instance `d` is an lvalue and not temporary, why should the move constructor be called?
+ 1
Yes.
0
My bad
Casted object is rvalue...right ? Not the d..so should be doing move(d) to have move constructor call