digitalmars.D.dwt - Anonomous class instances
- Bill Baxter (9/9) Apr 06 2008 I see a lot of this in the DWT examples:
- Frank Benoit (3/17) Apr 06 2008 I think they are the same. The () is the optional arguments list to the
- John Reimer (4/22) Apr 06 2008 I thought the '()' were required in D. I think I was getting errors whe...
- Bill Baxter (5/24) Apr 06 2008 That makes sense. Now that I think about it, there wouldn't be much
I see a lot of this in the DWT examples: new class() Listener { ... } Didn't even know you could do that till I saw it in DWT. But I just now ran across an example like this: new class Listener { ... } Is there a difference? If I had to guess I'd say the first one was creating a no-argument anonymous class template, but I have no idea why you'd want that instead of a regular anonymous class. --bb
Apr 06 2008
Bill Baxter schrieb:I see a lot of this in the DWT examples: new class() Listener { ... } Didn't even know you could do that till I saw it in DWT. But I just now ran across an example like this: new class Listener { ... } Is there a difference? If I had to guess I'd say the first one was creating a no-argument anonymous class template, but I have no idea why you'd want that instead of a regular anonymous class. --bbI think they are the same. The () is the optional arguments list to the ctor call.
Apr 06 2008
On Sun, 06 Apr 2008 19:18:23 +0200, Frank Benoit wrote:Bill Baxter schrieb:I thought the '()' were required in D. I think I was getting errors when I removed the parenthesis. Otherwise, it would make sense to drop them. -JJRI see a lot of this in the DWT examples: new class() Listener { ... } Didn't even know you could do that till I saw it in DWT. But I just now ran across an example like this: new class Listener { ... } Is there a difference? If I had to guess I'd say the first one was creating a no-argument anonymous class template, but I have no idea why you'd want that instead of a regular anonymous class. --bbI think they are the same. The () is the optional arguments list to the ctor call.
Apr 06 2008
Frank Benoit wrote:Bill Baxter schrieb:That makes sense. Now that I think about it, there wouldn't be much sense in making a template out of a class that will only ever have one instance. --bbI see a lot of this in the DWT examples: new class() Listener { ... } Didn't even know you could do that till I saw it in DWT. But I just now ran across an example like this: new class Listener { ... } Is there a difference? If I had to guess I'd say the first one was creating a no-argument anonymous class template, but I have no idea why you'd want that instead of a regular anonymous class. --bbI think they are the same. The () is the optional arguments list to the ctor call.
Apr 06 2008