
'INDEXED INHERITED MEMBERS - USING INHERITED METHODS

class cA
'=======

sys a,b
static sys s

method set(sys aa,bb)
a=aa : b=bb
end method

method sum() as sys
return a+b
end method

end class

class cB
'=======

sys a,b
static sys s

method set(sys aa,bb)
a=aa : b=bb
end method

method sum() as sys
return a+b
end method

end class


Class cM
'=======
sys d,e

has cA A[100]
has cB B[100]

method sum() as sys
indexbase 1
sys i,t
for i=1 to 100
  t+=a[i].sum
  t+=b[i].sum
next
return t
end method

end class


'#recordof cA
'#recordof cB
#recordof cM

cm c
c.a[3].set 1,2
c.b[3].set 2,3
print c.a[3].sum 'answer 3
print c.b[3].sum 'answer 5
print c.sum      'answer 8






