Say, I have a class A
Now when I am doing
A a(A());
what exactly happens?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Despite appearances,
A a(A());is not an object definition. Instead, it declares a function calledathat returns anAand takes a pointer to a function taking nothing and returning anA.If you want an object definition, you have to add another pair of parenthesis: