>
>
define class Part as custom
>procedure CalculateCost()
>* abstract method
>endproc
>enddefine
>
>define class SimplePart as Part
>procedure CalculateCost()
>return this.nCost
>enddefine
>
>define class CompositePart as Part
>procedure CalculateCost()
>local lnCost
>lnCost = 0
>for each oPart in this.oCollection
> lnCost = lnCost + oPart.CalculateCost()
>endfor
>return lnCost + this.nCost
>
>enddefine
>
>
Yes, this is something similar to what I had in mind. It would be difficult to find an instance of needing to go to 127 levels deep. I was originally thinking of having a seperate class to store the collection in, but I may not need to do that. That would reduce the number of method calls in half.
To not do recursion would require me to keep track of levels and start at the outmost level and work in. That would be VERY slow compared to recursion since I would have to loop thru a collection of all the objects once for every level. That would also require the objects to know who there parent was in the bom, whereas I only want the parent to be aware of who there children are since a part could be in multiple boms.
Derek Agar
Acctware Business Systems
derekagar@acctware.comICQ: 42332100
***********************
When in trouble call 911
He that dwelleth in the secret place
of the most High shall abide under
the shadow of the Almighty.
Psalm 91:1
***********************