Upstream version 1.3.40
[profile/ivi/swig.git] / Examples / test-suite / csharp / director_protected_runme.cs
1 using System;
2
3 namespace director_protectedNamespace {
4
5 public class runme
6 {
7   static void Main() 
8   {
9     runme r = new runme();
10     r.run();
11   }
12
13   void run()
14   {
15     Bar b  = new Bar();
16     Foo f = b.create();
17     FooBar fb = new FooBar();
18     FooBar2 fb2 = new FooBar2();
19
20     String s;
21     s = fb.used();
22     if ( s != ("Foo::pang();Bar::pong();Foo::pong();FooBar::ping();"))
23       throw new Exception("bad FooBar::used" + " - " + s);
24
25     s = fb2.used();
26     if ( s != ("FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();"))
27       throw new Exception("bad FooBar2::used");
28
29     s = b.pong();
30     if ( s != ("Bar::pong();Foo::pong();Bar::ping();"))
31       throw new Exception("bad Bar::pong");
32
33     s = f.pong();
34     if ( s != ("Bar::pong();Foo::pong();Bar::ping();"))
35       throw new Exception("bad Foo::pong");
36
37     s = fb.pong();
38     if ( s != ("Bar::pong();Foo::pong();FooBar::ping();"))
39       throw new Exception("bad FooBar::pong");
40   }
41 }
42
43 class FooBar : Bar
44 {
45   public FooBar() : base()
46   {
47   }
48
49   protected override String ping()
50   {
51     return "FooBar::ping();";
52   }
53 }
54
55 class FooBar2 : Bar
56 {
57   public FooBar2() : base()
58   {
59   }
60
61   protected override String ping()
62   {
63     return "FooBar2::ping();";
64   }
65
66   protected override String pang()
67   {
68     return "FooBar2::pang();";
69   }
70 }
71
72 }