wrote:
> Hi!
>
> When defining a new object m of class MyClass, with no parameters to
> the constructor, one is supposed to write "MyClass m;". If one wants to
> pass a parameter p to the constructor, one is supposed to write
> "MyClass m(p);". It doesn't work if one writes "MyClass m();" when one
> wants to pass zero parameters. Why is that? It seems inelegant and
> non-symmetric to me. What reason is there behind this?
You're right in that it is kind of unintuitive. The reason is that
"MyClass m();" already has another meaning. It declares a function taking no
arguments and returnint MyClass, similar to "int myfunc();".