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

/trunk/Examples/test-suite/d/director_protected_runme.1.d

#
D | 50 lines | 40 code | 10 blank | 0 comment | 10 complexity | 4ac1d231d46e3600838dedc987778e00 MD5 | raw file
 1module director_protected_runme;
 2
 3import director_protected.Foo;
 4import director_protected.Bar;
 5
 6void main() {
 7  Bar b = new Bar();
 8  Foo f = b.create();
 9  auto fb = new FooBar();
10  auto fb2 = new FooBar2();
11
12  char[] s;
13  s = fb.used();
14  if ( s != ("Foo::pang();Bar::pong();Foo::pong();FooBar::ping();"))
15    throw new Exception("bad FooBar::used" ~ " - " ~ s);
16
17  s = fb2.used();
18  if ( s != ("FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();"))
19    throw new Exception("bad FooBar2::used");
20
21  s = b.pong();
22  if ( s != ("Bar::pong();Foo::pong();Bar::ping();"))
23    throw new Exception("bad Bar::pong");
24
25  s = f.pong();
26  if ( s != ("Bar::pong();Foo::pong();Bar::ping();"))
27    throw new Exception("bad Foo::pong");
28
29  s = fb.pong();
30  if ( s != ("Bar::pong();Foo::pong();FooBar::ping();"))
31    throw new Exception("bad FooBar::pong");
32}
33
34class FooBar : Bar {
35protected:
36  override char[] ping() {
37    return "FooBar::ping();";
38  }
39}
40
41class FooBar2 : Bar{
42protected:
43  override char[] ping() {
44    return "FooBar2::ping();";
45  }
46
47  override char[] pang() {
48    return "FooBar2::pang();";
49  }
50}