fork download
  1. using System;
  2. class PruebaOcultamiento
  3. {
  4. public class ClaseBase
  5. {
  6. public int x;
  7.  
  8. public void Invocar ()
  9. {
  10. Console.WriteLine ("ClaseBase.Invocar");
  11. }
  12. }
  13.  
  14. public class ClaseDerivada : ClaseBase
  15. {
  16. new public void Invocar ()
  17. {
  18. Console.WriteLine ("ClaseDerivada.Invocar");
  19. }
  20. }
  21.  
  22. public static void Main ()
  23. {
  24. ClaseDerivada cd = new ClaseDerivada ();
  25.  
  26. ClaseBase cb = cd;
  27.  
  28. cb.Invocar();
  29. }
  30. }
Success #stdin #stdout 0.02s 33856KB
stdin
Standard input is empty
stdout
ClaseBase.Invocar