struct A{
A(){}
};
struct B{
B(const A& a){}
};
int main()
{
//Originally I would like to write down below code
A a;
B b(a);
//Unfortunately I end up with below code by accident and there is no compile error
//I have figured out the below does not create temporary A and call B constructor to
//create B as the above codes,
//it declares a function with return value B, name b,
//and some input parameter, my question is 1) what the input parameter is ?
//2) How to implement such a function.
B b(A()); // There is no global function A() in my test case.
}
問題是在評論中,我希望有人能幫助我理解它。非常感謝你。聲明一個具有類構造函數作爲函數參數的函數
相關:[最令人煩惱的解析](http://en.wikipedia.org/wiki/Most_vexing_parse)。 – dasblinkenlight 2014-10-20 21:33:02