![]() |
![]() |
![]() |
![]() |
![]() |
|
One simple way to keep track of what has gone into a union array element is to maintain a parallel array of type-identifying integers.
*-- Indicates that the first element in trade_pointers array
| points to a union that contains a stock_trade object
v
*---*---*---*---*---*
| 0 | 0 | 1 | 1 | 0 |
*---*---*---*---*---*
^
|
*-- Indicates that the third element in trade_pointers array
points to a union that contains a bond_trade object