#include <iostream>
class A{
};
class B: public A{
public:
B(A&& inA){
std::cout<<"constructor"<<std::endl;
}
};
int main(){
B whatever{A{}};
whatever=A{};
}
This outputs
constructor
constructor
at least with C++14 standard and GCC. How is it defined that assignment operator can result in call to constructor instead of operator=
? Is there a name for this property of assignment operator?