Guest User

Untitled

a guest
May 17th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. // Define the base class
  2. class Car
  3. {
  4. public virtual void DescribeCar()
  5. {
  6. System.Console.WriteLine("Four wheels and an engine.");
  7. }
  8. }
  9.  
  10. // Define the derived classes
  11. class ConvertibleCar : Car
  12. {
  13. public new virtual void DescribeCar()
  14. {
  15. base.DescribeCar();
  16. System.Console.WriteLine("A roof that opens up.");
  17. }
  18. }
  19.  
  20. class Minivan : Car
  21. {
  22. public override void DescribeCar()
  23. {
  24. base.DescribeCar();
  25. System.Console.WriteLine("Carries seven people.");
  26. }
  27. }
Add Comment
Please, Sign In to add comment