DEFINE CLASS Sample AS CUSTOM tTimeCreated = DATETIME() ENDDEFINEIn this class the developer erroneously thinks *each object* will be stamped with its creation time, while in fact all objects will have the same value:
o1 = CREATEOBJECT("Sample") DECLARE Sleep IN Win32API Integer Sleep(1000) && force a delay between object creation o2 = CREATEOBJECT("Sample") ? IIF(o1.tTimeCreated <> o2.tTimeCreated, "Different", "Oops!")I'm glad to see that at least VFP 9 prevents you from doing this with *objects*. In a code review, I would flag *any* use of an expression in constructor code for examination.
DEFINE CLASS c1 AS CUSTOM ADD OBJECT o AS c2or you want an (non-container) object reference:
DEFINE CLASS c1 AS CUSTOM o = NULL FUNCTION INIT o = CREATEOBJECT("c2")-- Randy