Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Base {
- public virtual string WhoAmI() { return "Base"; }
- }
- class Derived : Base {
- public override string WhoAmI() { return "Derived"; }
- }
- class MainClass
- {
- public static void Main(string[] args)
- {
- Base b = new Derived();
- Console.WriteLine(b.WhoAmI()); // Derived
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment