new A().b() currently requires extra brackets/parentheses

Ben Davis entheh at cantab.net
Sun Sep 9 06:39:23 PDT 2012


Hi,

On 09/09/2012 14:23, Philippe Sigaud wrote:
 > you could use factory functions:
 >
 > class A {}
 >
 > A a() { return new A();}

Good idea. It might not work so well for me because the user might also 
be creating custom GUI components and would therefore have to create 
their own factory functions, but thanks for the idea in any case.

 > For the delegate at the end, I *guess* (but I'm not certain) that just
 > using { ... } will work. It's a void delegate().

You're right - it does compile without the keyword. Thanks again :)

Ben :)


More information about the Digitalmars-d mailing list