Interfaces

alexander Patapoff via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 9 02:11:39 PDT 2016


On Saturday, 9 April 2016 at 08:59:13 UTC, ag0aep6g wrote:
> On 09.04.2016 10:45, alexander Patapoff wrote:
>> [...]
>
> There is a somewhat obscure feature which lets you declare and 
> instantiate a class at the same time:
>
> ----
> interface Action
> {
>   void actions(int x);
> }
>
> void main()
> {
>   Action action = new class Action {
>       void actions(int x) {/* ... */}
>   };
> }
> ----
>
> http://dlang.org/spec/class.html#anonymous

Yaaay! thank you!


More information about the Digitalmars-d-learn mailing list