Inline New Class

Malkierian rhydonj at gmail.com
Fri Mar 21 21:35:55 PDT 2014


OK, so I don't even know what it's actually called, but for 
example, in Java:

exitItem.addSelectionListener(new SelectionAdapter() {

             @Override
             public void widgetSelected(SelectionEvent e) {
                 shell.getDisplay().dispose();
                 System.exit(0);
             }
         });

You can create a new subclass of one you want to use in a 
function, with subclass function overrides such as this, but yet 
I can't seem to figure out how to do this in D.  The first 
bracket always has a red underline telling me it's expecting a 
')' (or a ';' in the case of trying to declare the listener 
before using it in addSelectionListener).


More information about the Digitalmars-d mailing list