fork download
  1. using System;
  2.  
  3. public abstract class MyBase
  4. {
  5. public abstract bool GetValue(bool value = true);
  6. }
  7.  
  8. public class MyDerived : MyBase
  9. {
  10. public override bool GetValue(bool value = false)
  11. {
  12. return value;
  13. }
  14. }
  15.  
  16. public class Test
  17. {
  18. public static void Main()
  19. {
  20. var derived = new MyDerived();
  21. Console.WriteLine("Value = {0}", derived.GetValue());
  22. MyBase myBase = derived;
  23. Console.WriteLine("Value = {0}", myBase.GetValue());
  24. }
  25. }
  26.  
Success #stdin #stdout 0.02s 33856KB
stdin
Standard input is empty
stdout
Value = False
Value = True