CLEAR loItem = CREATEOBJECT("wwDynamic") loItem.Bogus = "This is bogus" loItem.Entered = DATETIME() ? loItem.Bogus ? loItem.Entered *loItem.oChild = CREATEOBJECT("wwDynamic") loItem.oChild.Bogus = "Child Bogus" loItem.oChild.Entered = DATETIME() ? loItem.oChild.Bogus ? loItem.oChild.Entered ************************************************************* DEFINE CLASS wwDynamic AS RELATION ************************************************************* __oReference = null *** Intercept access to unknown properties and create FUNCTION THIS_Access(lcPropertyOrMethod) If Lower(lcPropertyOrMethod) == "__oreference" Return This Endif If !Pemstatus(This.__oReference,lcPropertyOrMethod,5) AddProperty(this.__oReference,lcPropertyOrMethod,Createobject('wwDynamic')) ENDIF RETURN this.__oReference ENDFUNC ************************************************************************ * Init **************************************** *** Function: *** Assume: *** Pass: *** Return: ************************************************************************ FUNCTION Init(loBaseType) IF !VARTYPE(loBaseType) = "O" this.__oReference = CREATEOBJECT("Empty") ENDIF ENDFUNC * Init ENDDEFINE *EOC wwDynamicNotice the removed call of `this.oChild = CREATEOBJECT("wwDynamic")` which is replaced by the code inside of the PEMSTATUS. This allows cascading objects without having to do anything special.
>public oMyPc && check later on your debugger > >oMyPc = Createobject('empty') > >With _( oMyPc ) && simply pass object you want to modify, any referenced property will be added to passed object if does not exist: > > .madeBy = 'Marco Plaza, 2018 - nfTools' > .manufacturer = 'custom' > .basePrice = 699 > .caseType = 'ATX' > .modelName = 'Ryzen Performance Plus' > > With _( .cpu ) && cpu will be a new object for oMyPc - check we pass ".cpu" ( dot cpu ) because it's inside with - endwith > .processorcount = 6 > .brand = 'AMD' > .model = 'Ryzen 7' > .clockspeed = 4.3 > .processorCount = 8 > Endwith > > With _(.motherboard) > > .manufacturer = 'Asus' > .model = 'Prime B350-Plus AMD' > .formfactor = 'ATX' > > With _(.slots) > .Memory = 4 > .m2 = 1 > .pcie = 4 > Endwith > > With _(.storage,'primaryDisk') && here we create ".storage" and ".storage.primaryDisk" in a single pass > .manufacturer = 'Samsung' > .model = '960 evo Series' > .Type = 'internal' > .connectivity = 'PCIe NVMe M.2' > .capacity = '250gb' > Endwith > > With _(.storage,'backupDisk') > .manufacturer = 'Seagate' > .model = 'Barracuda ST3000DM008' > .Type = 'Internal' > .formfactor = 3.5 > .capacity = '3tb' > .connectivity = 'Sata 6.0' > .rotationspeed = 7200 > Endwith > > Endwith > >Endwith > >