Guest User

Untitled

a guest
Jun 5th, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.29 KB | None | 0 0
  1. class Base {
  2.     public virtual string WhoAmI() { return "Base"; }
  3. }
  4.  
  5. class Derived : Base {
  6.     public override string WhoAmI() { return "Derived"; }
  7. }
  8.  
  9. class MainClass
  10. {
  11.     public static void Main(string[] args)
  12.     {
  13.         Base b = new Derived();
  14.         Console.WriteLine(b.WhoAmI()); // Derived
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment