Guest User

Untitled

a guest
Oct 21st, 2011
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. $ cat test.java
  2. interface I1 { int getP (); }
  3. interface I2 { int getP (); }
  4. interface I3 extends I1, I2 {}
  5.  
  6. class C
  7. {
  8. static int M ()
  9. {
  10. I3 o = null;
  11. return o.getP ();
  12. }
  13. }
  14.  
  15. $ cat test.cs
  16. public interface I1 { int GetP (); }
  17. public interface I2 { int GetP (); }
  18. public interface I3 : I1, I2 {}
  19.  
  20. public class C
  21. {
  22. static int M ()
  23. {
  24. return default (I3).GetP ();
  25. }
  26. }
  27.  
  28. $ javac test.java
  29.  
  30. $ mcs test.cs
  31. test.cs(9,24): warning CS1720: Expression will always cause a `System.NullReferenceException'
  32. test.cs(9,37): error CS0121: The call is ambiguous between the following methods or properties: `I1.GetP()' and `I2.GetP()'
  33. test.cs(1,27): (Location of the symbol related to previous error)
  34. test.cs(2,27): (Location of the symbol related to previous error)
  35. error CS5001: Program `test.exe' does not contain a static `Main' method suitable for an entry point
  36. Compilation failed: 2 error(s), 1 warnings
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment