• Source
    1. public class Shape{
    2.  
    3. // A few example members
    4. public int X {
    5. get;
    6. private set;
    7. }
    8.  
    9. public int Y {
    10. get;
    11. private set;
    12. }
    13.  
    14. public int Height {
    15. get;
    16. set;
    17. }
    18.  
    19. public int Width {
    20. get;
    21. set;
    22. }
    23.  
    24. // Virtual method
    25. public virtual void Draw(){
    26. Console.WriteLine("Performing base class drawing tasks");
    27. }
    28. }
    29.  
    30. class Circle : Shape{
    31.  
    32. //Override the Draw method in the Circle Class
    33. public override void Draw(){
    34. // Code to draw a circle...
    35. Console.WriteLine("Drawing a circle");
    36. base.Draw();
    37. }
    38. }
    39.