In VB.NET, say I have a function
Public Function Foo(ByVal currentShape as Shape)
Instead up passing in a Shape object, I pass in a subclass of Shape called Square like such:
Dim square As Square = new Square()
Foo(square)
Do I need to convert my Square object to a Shape object before passing it in? If so, how do I do this?
Squareis-aShape.You don’t need to convert anything.
All subclasses are implicitly convertible to their superclasses.