digitalmars.D.learn - Anonymous class
- tcak (11/11) Oct 12 2016 I feel like I remember that this was added to D a while ago, but
- tcak (8/19) Oct 12 2016 Hmm. Yeah, after playing around, and some clues from net search.
- ag0aep6g (3/13) Oct 12 2016 runIt(new class Runnable { void run() { /* do stuff */ }});
- Adam D. Ruppe (3/4) Oct 12 2016 It has been there since the beginning, more or less, as long as I
I feel like I remember that this was added to D a while ago, but 
I am not sure. Is it possible to create anonymous classes?
public interface Runnable{
     void run();
}
runIt( new Runnable(){
     void run(){
         /* do stuff */
     }
});
I want to do this without making the things any complex.
 Oct 12 2016
On Wednesday, 12 October 2016 at 11:56:21 UTC, tcak wrote:
 I feel like I remember that this was added to D a while ago, 
 but I am not sure. Is it possible to create anonymous classes?
 public interface Runnable{
     void run();
 }
 runIt( new Runnable(){
     void run(){
         /* do stuff */
     }
 });
 I want to do this without making the things any complex.
Hmm. Yeah, after playing around, and some clues from net search. 
I found it.
runIt( new class Runnable{
      void run(){
          /* do stuff */
      }
});
 Oct 12 2016
On 10/12/2016 01:56 PM, tcak wrote:
 I feel like I remember that this was added to D a while ago, but I am
 not sure. Is it possible to create anonymous classes?
 public interface Runnable{
     void run();
 }
 runIt( new Runnable(){
     void run(){
         /* do stuff */
     }
 });
runIt(new class Runnable { void run() { /* do stuff */ }});
https://dlang.org/spec/class.html#anonymous
 Oct 12 2016
On Wednesday, 12 October 2016 at 11:56:21 UTC, tcak wrote:I feel like I remember that this was added to D a while agoIt has been there since the beginning, more or less, as long as I can remember.
 Oct 12 2016








 
  
  
 
 tcak <1ltkrs+3wyh1ow7kzn1k sharklasers.com>
 tcak <1ltkrs+3wyh1ow7kzn1k sharklasers.com> 