PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/d/callback/d2/runme.d

#
D | 36 lines | 30 code | 6 blank | 0 comment | 0 complexity | 4865d060c57ee0940cab907b1e3796b1 MD5 | raw file
 1module runme;
 2
 3import std.stdio;
 4import example;
 5
 6public class DCallback : Callback {
 7  public override void run() {
 8    writeln( "DCallback.run()" );
 9  }
10}
11
12void main() {
13  auto caller = new Caller();
14
15  writeln( "Adding and calling a normal C++ callback" );
16  writeln( "----------------------------------------" );
17  {
18    scope auto callback = new Callback();
19    caller.setCallback(callback);
20    caller.call();
21    caller.resetCallback();
22  }
23
24  writeln();
25  writeln( "Adding and calling a D callback" );
26  writeln( "-------------------------------" );
27  {
28    scope auto callback = new DCallback();
29    caller.setCallback(callback);
30    caller.call();
31    caller.resetCallback();
32  }
33
34  writeln();
35  writeln( "D exit" );
36}