Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Application
- {
- public interface I
- {
- void Go();
- }
- public class A : I
- {
- public void Go()
- {
- Console.WriteLine("A.Go()");
- }
- }
- public class B : A
- {
- }
- public class C : B
- {
- public new void Go()
- {
- Console.WriteLine("C.Go()");
- }
- }
- class MainClass
- {
- public static void Main(string[] args)
- {
- B b1 = new B();
- C c1 = new C();
- B b2 = c1;
- b1.Go();
- c1.Go();
- b2.Go();
- ((I) b2).Go();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement