B
Brien King
Ok, I have three classes (The example here is extremely simplified to
illustrate the problem) like this:
Public Class A
Public Sub DoSomething(ByVal myClass)
If TypeOf myClass IS A Then
'
' Never Enters here....
'
End If
End Sub
End Class
Public Class B
Inherits Class A
End Class
Public Class C
Inherits Class B
End Class
Then I use Class C to do some work like this:
dim myClassC1 as New C
dim myClassC2 as New C
C1.DoSomething(C2)
The problem is, is that when DoSomething is executed on the Base class, the
TypeOf check fails and says that the object passed in is NOT of the type A.
I was under the impression that the TypeOf would return True if the object
was the specific class I was asking about or any class that derived from it.
Since C derives from B which derives from A, C IS a type of A. Is this
incorrect? Or am I missing something?
Any help would be greatly appreciated!
Brien King
(e-mail address removed) (real email address)
http://www.arcaderestoration.com
illustrate the problem) like this:
Public Class A
Public Sub DoSomething(ByVal myClass)
If TypeOf myClass IS A Then
'
' Never Enters here....
'
End If
End Sub
End Class
Public Class B
Inherits Class A
End Class
Public Class C
Inherits Class B
End Class
Then I use Class C to do some work like this:
dim myClassC1 as New C
dim myClassC2 as New C
C1.DoSomething(C2)
The problem is, is that when DoSomething is executed on the Base class, the
TypeOf check fails and says that the object passed in is NOT of the type A.
I was under the impression that the TypeOf would return True if the object
was the specific class I was asking about or any class that derived from it.
Since C derives from B which derives from A, C IS a type of A. Is this
incorrect? Or am I missing something?
Any help would be greatly appreciated!
Brien King
(e-mail address removed) (real email address)
http://www.arcaderestoration.com