Foo Foo = new Foo();
Adam D. Ruppe
destructionator at gmail.com
Sun Feb 21 18:24:27 UTC 2021
On Sunday, 21 February 2021 at 18:15:22 UTC, JN wrote:
> I guess D is smart enough to figure out which is a type and
> which is a variable. C++ gets confused in similar situation.
Well it isn't about type vs variable (except for in this exact
declaration), it is just one is defined at top level and the
other is defined local to the function. You can have local
variables with the name name as top-level variables.
If you had another local thing called Foo already, even if it was
a type and not a variable, then it would complain.
More information about the Digitalmars-d-learn
mailing list