title: How to call a member through its parent's type that shadowed a parent class implementation
body: <p>This is a challenging one that got me stumped while I was coding today. Suppose I am running the <code>Sub Test1()</code> and <code>Test2()</code> and would like to print out the value of the <code>Shadows</code> method of the <em>instance</em> of the object I am passing in to <code>TestCall()</code> (see below - it is clearer) using the following restrictions:</p>
  
  <ol>
  <li>Can't change the contents of <code>Class A</code>, <code>B</code>, and <code>C</code> </li>
  <li>Can't change <code>Sub Test1()</code> and <code>Sub Test2()</code> </li>
  <li>TestCall() can't have an <code>if</code>, <code>select case</code> etc. statement that tries to figure out the type of the argument passed in and then do <code>CType(o, &lt;C or B&gt;).Method()</code>. Suppose there are an infinite number of classes like <code>B</code> and <code>C</code> all of which inherit from <code>A</code> or <code>B</code> or <code>C</code> and shadow <code>Method</code></li>
  <li>You can't change the attributes of Subs (i.e. you can't change <code>Shadows</code> to <code>Overridable/Overrides</code>)</li>
  </ol>
  
  <p>I would like to dynamically do the equivalent of <code>CType(o, C).Method()</code> and print out <code>C.Method</code> for Test1 and then dynamically do the equivalent of <code>CType(o, B).Method()</code> and print out <code>B.Method</code>. </p>
  
  <pre><code>&lt;TestFixture()&gt; _
  Public Class Test
  
      &lt;Test()&gt;
      Public Sub Test1()
          Dim o As A = New C
          TestCall(o)  '&lt;-- THIS SHOULD PRINT "C.Method"
      End Sub
  
      Public Sub Test2()
          Dim o As A = New B
          TestCall(o)  '&lt;-- THIS SHOULD PRINT "B.Method"
      End Sub
  
      Public Sub TestCall(ByVal o as A)
            o.Method() 
      End Sub
  
      Class A
          Public Sub Method()
              Console.WriteLine("A.Method")
          End Sub
      End Class
  
      Class B
          Inherits A
  
          Public Shadows Sub Method()
              Console.WriteLine("B.Method")
          End Sub
      End Class
  
      Class C
          Inherits B
  
          Public Shadows Sub Method()
              Console.WriteLine("C.Method")
          End Sub
      End Class
  End Class
  </code></pre>