add ISafeSerializationData
[mcs.git] / tests / test-136.cs
blob562cdbee956c3d32014f014772f0e07d2cf00db8
1 //
2 // Tests that explicit and normal implementations of methods are handled
3 // properly. Before we used to have the normal method implementation
4 // "implement" the classes, so that it would go into an infinite loop.
5 // (bug #26334)
6 //
7 // Now explicit implementations are defined first.
8 //
9 using System;
11 public interface IDiagnostic
13 void Stop();
15 public interface IAutomobile
17 void Stop();
20 public class MyCar: IAutomobile, IDiagnostic {
21 public bool diag_stop, car_stop, auto_stop;
23 void IDiagnostic.Stop() {
24 diag_stop = true;
27 public void Stop() {
28 car_stop = true;
29 IAutomobile self = (IAutomobile)this; // cast this
30 self.Stop(); // forwarding call
33 void IAutomobile.Stop()
35 auto_stop = true;
39 class TestConflict {
40 static int Main ()
42 MyCar car1 = new MyCar();
43 car1.Stop(); // calls the IAutomobile.Stop implementation
45 IDiagnostic car2 = new MyCar();
46 car2.Stop();
48 IAutomobile car3 = new MyCar();
49 car3.Stop();
51 if (!car1.car_stop)
52 return 1;
54 if (car1.diag_stop)
55 return 2;
57 Console.WriteLine ("ok");
58 return 0;