One of the most interesting grammars of any programming languages.
Three of these things belong together, and two are something altogether different...
SomeType t = u;
SomeType t(u);
SomeType t();
SomeType t;
SomeType t(SomeType(u));
All but the third and fifth define a SomeType
object on the stack and initialize it (with u
in the first two case, and the default constructor in the fourth. The third is declaring a function that takes no parameters and returns a SomeType
. The fifth is similarly declaring a function that takes one parameter by value of type SomeType
named u
.