A short example by using 'Boolean' type and two 'Dim Byref' references (two base-references to derived objects) acting in polymorphic way:
Code: Select all
Type Parent Extends Object
Declare Abstract Property rtnB () As Boolean
End Type
Type Child1 Extends Parent
Declare Virtual Property rtnB () As Boolean Override
Dim As Boolean b = False
End Type
Virtual Property Child1.rtnB () As Boolean
Return This.b
End Property
Type Child2 Extends Parent
Declare Virtual Property rtnB () As Boolean Override
Dim As Boolean b = True
End Type
Virtual Property Child2.rtnB () As Boolean
Return This.b
End Property
Dim As Child1 c1
Dim As Child2 c2
Dim Byref As Parent rpc1 = c1, rpc2 = c2
Print rpc1.rtnB
Print rpc2.rtnB
Sleep
Code: Select all
false
true