Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Child2 s = new Child2();
- s.foo();
- }
- }
- class Base
- {
- public virtual void foo()
- {
- Console.WriteLine("base");
- bar();
- }
- public virtual void bar()
- {
- //hey I m here just for purpose, I know I m so reduntant
- }
- }
- class Child1 : Base
- {
- public override void bar()
- {
- Console.WriteLine("bar in child1");
- }
- }
- class Child2 : Child1
- {
- public override void foo()
- {
- Console.WriteLine("child2");
- base.foo();
- }
- }
- }
- child2
- base
- bar in child1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement