>(just very simplistic, not tested)
>
>
FUNCTION AddObjectToContainer(cClassKey, oParent, cName)
>LOCAL oObject
>
>oObject = NULL
>
>IF !USED("MyFactoryClasses")
> USE MyFactoryClasses IN 0 ORDER ClassKey
>ENDIF
>
>IF SEEK(cClassKey, "MyFactoryClasses")
> oParent.AddObject(cName, MyFactoryClasses.ActualClass)
>*** oObject = oParent.&cName
oObject=getpem(oParent, cName)
>ENDIF
>RETURN oObject
And you don't even need the macro. See my intervention above.
>When writing I don't have a clue what oParent is. It could be a form, a grid, a container, a toolbar, _screen. I don't know what type of object has been added to the form etc... I don't care here either.
>
>The point is however, that in particular cases you don't give a hoot about its type, because YOU AS A PROGRAMMER know that certain properties and methods do exist, and telling the compiler the same might be very difficult. This is the reason virtual classes and virtual methods exist. You'll have to bend everyhting into making the compiler happy because it wants to know all at compile time.