A private nested UDT in a base Type should not be accessible from the declaration zone of a derived Type.
But no problem for the access from the procedure body of a derived Type (forbidden access).
Example with private/protected/public members inside a base Type:
- with nested UDTs, (NOK)
- with static integers, (OK)
referred from a derived Type:
- from declaration zone, (NOK)
- from procedure body, (OK)
and also referred from the main code. (OK)
Type Parent
Dim As Integer __
Private:
Static As Integer IP1
Type UDTP1
Dim As Integer __
End Type
Protected:
Static As Integer IP2
Type UDTP2
Dim As Integer __
End Type
Public:
Static As Integer IP3
Type UDTP3
Dim As Integer __
End Type
End Type
Dim As Integer Parent.IP1
Dim As Integer Parent.IP2
Dim As Integer Parent.IP3
Type Child Extends Parent
Dim As UDTP1 UC1 '' No error: NOK, should be error: 'Illegal member access' ***** BUG *****
Dim As UDTP2 UC2 '' No error: OK
Dim As UDTP3 UC3 '' No error: OK
Dim As Integer IC1 = IP1 '' error OK: 'Illegal member access'
Dim As Integer IC2 = IP2 '' No error: OK
Dim As Integer IC3 = IP3 '' No error: OK
Declare Constructor()
End Type
Constructor Child()
Dim As UDTP1 UC1 '' error OK: 'Illegal member access'
Dim As UDTP2 UC2 '' No error: OK
Dim As UDTP3 UC3 '' No error: OK
Dim As Integer IC1 = IP1 '' error OK: 'Illegal member access'
Dim As Integer IC2 = IP2 '' No error: OK
Dim As Integer IC3 = IP3 '' No error: OK
End Constructor
Dim As Parent.UDTP1 UC1 '' error OK: 'Illegal member access'
Dim As Parent.UDTP2 UC2 '' error OK: 'Illegal member access'
Dim As Parent.UDTP3 UC3 '' No error: OK
Dim As Integer IC1 = Parent.IP1 '' error OK: 'Illegal member access'
Dim As Integer IC2 = Parent.IP2 '' error OK: 'Illegal member access'
Dim As Integer IC3 = Parent.IP3 '' No error: OK
See the line corresponding to the '..... ***** BUG *****' comment.
(this line should normally trigger a compile error)
Same bug for a nested named Union.