Delegates: Difference between revisions
Content deleted Content added
Capra Hircus (talk | contribs) No edit summary |
Updated only the first D entry (I don't have Tango) |
||
Line 389:
=={{header|D}}==
D has built-in delegates, so we can skip creating an additional
''Delegate'' object and pass a real delegate directly to '''Delegator'''.
<lang d>
string delegate() hasDelegate;
Line 410 ⟶ 408:
void main() {
import std.stdio;
auto dr = new Delegator;
writeln(dr.operation());
writeln(dr.operation());
writeln(dr.setDg(thing).operation());
}</lang>
{{out}}
<pre>Default implementation
Default implementation
Delegate implementation</pre>
===Version using Tango===
{{libheader|tango}}
|