title: Cannot cast an object to its parent object in Visual Basic
body: <p>In C# we can do something like this:</p>
  
  <p><code>Honda a = new Car();</code> and that works but the same one doesn't work in Visual Basic.NET (I am fairly new to Visual Basic)</p>
  
  <p><code>Dim a as Honda = new Car</code> and it says Unable to cast object of type 'SampleApp.Car' to type 'SampleApp.Honda'.</p>
  
  <p>What's wrong here?</p>
  
  <p>Here is my sample code:</p>
  
  <pre><code>Module Module1
  
      Sub Main()
          Dim a As B = New A
          Console.WriteLine(a.DoSOmething())
          Console.ReadLine()
      End Sub
  End Module
  
  Class A
      Public Overridable Function DoSOmething() As String
          Return "SOmething"
      End Function
  End Class
  
  Class B
      Inherits A
  
      Public Overrides Function DoSOmething() As String
          Return "Something else"
      End Function
  
  End Class
  </code></pre>