DO wwDynamic CLEAR loCust = CREATEOBJECT("TestClass") loItem = CREATEOBJECT("wwDynamic",loCust) loItem.Bogus = "This is bogus" loItem.Entered = DATETIME() ? loItem.Bogus ? loItem.Entered *loItem.oChild = CREATEOBJECT("wwDynamic") *loChild = loItem.oChild WITH loItem.oChild .Bogus2 = "Child Bogus" .Entered2 = DATETIME() ? .Bogus2 ? .Entered2 ENDWITH ? loItem.cFirstName ? loItem.cLastName ? loItem.GetFullname() DEFINE CLASS TestClass as Custom cFirstName = "Rick" cLastName = "Strahl" FUNCTION GetFullName() RETURN this.cFirstname + " " + this.cLastname ENDDEFINEDoesn't look like there's a problem with `WITH loItem.oChild` in this scenario as that would still resolve to the reference.
SET PROCEDURE TO wwDynamic ADDITIVE ************************************************************* DEFINE CLASS wwDynamic AS RELATION ************************************************************* *: original Author: Marco Plaza, 2018 @vfp2nfox *: modified by: Rick Strahl ************************************************************* __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") ELSE this.__oReference = loBaseType ENDIF ENDFUNC * Init ENDDEFINE *EOC wwDynamic