culebrin 0 Junior Poster in Training

Hi,

I have this:

Public Class bParentClass
[...]
End Class

Public Class bChildClass1
inherits bParentClass
[...]
End Class

So, I do this:

Dim vChildClass1 as bChildClass1 '<-- Here I create a reference to a child class type

vChildClass1 = New bChildClass1 '<-- Here I point to a new object of the class type

Dim vParentClass1 as bParentClass '<-- Here I create a reference to a parent class type

vParentClass1 = vChildClass1 '<-- Here I point the parent type reference to a child type reference

At this point, I understand that, the original child object in memory, NOT THE REFERENCE, created remain the same, therefore, if I do

TypeOf vParentClass1 Is bChildClass1

(the reference is still pointing to the same object) it should be true, but is not, someone can explain me why?, and most importantly, how can I get the original type (the one that object was created) from the parent reference? someting like the viewstate object, it keep the type intact.

Or maybe I just totally wrong... :S

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.