Say, I have a class A
Now when I am doing
A a(A());
what exactly happens?
Despite appearances, A a(A()); is not an object definition. Instead, it declares a function called a that returns an A and takes a pointer to a function taking nothing and returning an A.
If you want an object definition, you have to add another pair of parenthesis:
A a((A()));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With