Anonymous class
tcak via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Oct 12 04:59:32 PDT 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 */
}
});
More information about the Digitalmars-d-learn
mailing list