If a have a class with both standard and copy constructors
class Ex{
//constructor definitions
}
and a function that takes it as an argument (by value)
void F(Ex _exin){...}
take the following piece of code:
Ex A;
F(A); //F's parameter is copy constructed from A
F(Ex()); //F's parameter uses the default constructor
In the third line I'm passing to F a new (temporary) object of the Ex class using the default constructor. My question is: after this new object is created is it also copy constructed/assigned (like it happens in the second line) or is it directly created "inside" F?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…