Without seeing your code, here is an example of how to create a method that receives a parent object reference but a Child object reference is actually sent. This won't give you any errors and is acceptable code.
Public Class ParentClass
End Class
Public Class Child1Class
Inherits ParentClass
End Class
Public Class MyMethods
Public Sub Meth1(ByVal p1 As ParentClass)
End Sub
Public Sub Meth2()
Dim x As Child1Class
Meth1(x)
End Sub
End Class
However, the following is not valid because you can't pass a parent object where a child object is expected:
Public Class ParentClass
End Class
Public Class Child1Class
Inherits ParentClass
End Class
Public Class MyMethods
Public Sub Meth1(ByVal p1 As Child1Class)
End Sub
Public Sub Meth2()
Dim x As ParentClass
Meth1(x)
End Sub
End Class
>All,
>
>I have a business object base class which I subclass for my specific applications. These subclasses are the base class for all application business objects. I read in ".Net for Visual Foxpro Developers" about polymorphism and virtual methods, that given 3 classes, A, B, and C where B and C are subclasses of A, that a variable of type A can hold a reference to either classes B or C. I have created a function to which I wish to send a reference to a business object. In the function I have a parameter of type ODHBusinessObjectBase to which I am sending an object, by reference, of type CAudienceType which is a subclass of ODHBusinessObjectBase. I get an error that option strict on disallows implicit conversion from ODHBusinessObjectBase to CAudienceTypes.
>
>How can I create a generic function to take a reference to a specific class?
>
>TIA
>
>Rex
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi