When you use the new keyword on Bar.Test , you say that it is not related to Foo.Test , except that it has the same name. Since Baz inherits from Bar, it overrides Bar.Test , but leaves Foo.Test unmodified.
When you call fooBaz.Test , it scans the unmodified Foo.Test method and prints "Foo".
When you call barBaz.Test , it looks at the override method of Bar.Test and prints "Baz".
Trevor merrifield
source share