954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Parent and Child Classes

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 childobject 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 betrue, 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

culebrin
Junior Poster in Training
62 posts since Aug 2007
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: