Created
October 1, 2018 07:49
-
-
Save retran/9f4dc4c359d8e91d163e2452a642863c to your computer and use it in GitHub Desktop.
method hiding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace ConsoleApp1 | |
{ | |
class Foo | |
{ | |
public void Do() | |
{ | |
throw new InvalidOperationException(); | |
} | |
} | |
class Bar : Foo | |
{ | |
public new void Do() | |
{ | |
Console.WriteLine("Hello World!"); | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Foo foo = new Bar(); | |
foo.Do(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment