It's a little ... complicated, to say the least.
When working with objects, both notations are equivalent. When using primitive types (for example, int ) (3) will initialize (zero filling) the value, but (4) will not (the value will remain undefined).
For automatically assigned objects, this is:
Foo f1;
Declares and initializes the Foo object using the default constructor. It:
Foo f2 = Foo();
Declares and initializes the Foo object using the copy constructor, essentially copying the value of the temporary object ( Foo() ), which is built using the default constructor.
source share