Hi,
Quick (and probably simple) question regarding shadowing and
polymorphism. Problem is best explained by an example.
Public Class A
public CommonProperty as Integer
end class
Public Class AB : Inherits A
Public Specific as String
End Class
Public Class AC : Inherits A
Public Exclusive as Boolean
End Class
Public ClassB
Public MemberObject as new A
End Class
Public Class BA : Inherits B
Public shadows MemberObject as new AB
End Class
Question:
If I treat an instance of class BA as an instance of Class B and then
assign MyInstance.MemberObject to an instance of AB which I have downcast to
an instance of A what happens? Does the compiler figure everything out and
raise errors if I try to upcast a polymorphed AC (as an A) to
BA.MemberObject ?
Thanks!
Nick