Rick,
If your collected objects all inherit from a common "collection aware" baseclass you could add a custom oParentCollection property and populate it with a reference to the collection. You will be responsible for clearing this object ref so everything will destruct properly.
ocoll = createobject( "mycollection" )
ocoll.Add( createobject( "collected", oColl ), "1" )
ocoll.Add( createobject( "collected", oColl ), "2" )
oColl.Item( "1" ).DoIt()
define class collected as custom
oParentCollection = .null.
function Init( roCollection )
this.oParentCollection = roCollection
return dodefault()
endfunc
function DoIt()
this.oParentCollection.DoIt()
endfunc
enddefine
define class mycollection as collection
function DoIt()
? "I did it"
endfunc
enddefine
This means you are pretty tightly coupling your collected objects to the collection itself. There may be some other design pattern that will help you accomplish your end goal.
>I've started using collection classes to hold multiple objects. I would either like to get the objects in the collection to inherit properties of the collection class when they are Added to the collection, or be able to reference the properties of the collection class from the object in the collection. The objects in the collection are "owned" by the collection class in the way they are by a container class so I can't use the Parent designation. Is there any easy way to reference methods and properties of the collection from the collection's objects?