I have a base class, call it house, and two inherited classes: townhome and
condo.
I would like to write a function that could return either a townhome or a
condo. Here is how I am trying to implement it:
---------------------------------------------------------------------
Public MustInherit Class House
......
End Class
Public Class Townhome : Inherits House
......
End Class
Public Class Condo : Inherits House
......
End Class
Public Function GetAvailableHome(ByVal address as string) as House
......
End Function
---------------------------------------------------------------------
Now, GetAvailableHome needs to be able to return either a Townhome or a
Condo. RIght now, it returns a object that does not have the specific
property values that are specific to either a Townhome or Condo. The
returned object is the correct type, but all the inherited class specific
information is gone. Does anyone have any ideas? Is what I am trying to do
even possible in VB.NET. Thanks