假设我有:
Class Vehicle
Public Property NumberOfWheels As Integer
End Class
Class Bicycle
Inherits Vehicle
End Class
我愿意:
Dim b = New Bicycle() With {.NumberOfWheels = 2}
Dim v As Vehicle = CType(b, Vehicle)
当我调试代码并用鼠标悬停对象时v
仍然如此。Bicycle
如何从 Bicycle 类型的对象中获取 Vehicle 类型的对象?我必须手动完成吗?