by
Patwos >> Fri, 4 Nov 2005 21:44:39 GMT
Using the create statement instead of the undocumented Class::createInstance methd does not necessarily mean a big list of if-then sequences.
Assuming you pass "FRED" in as a string, and you have a means in the high level framework of locating the Class class instance for the FRED class, you can then use the "as" modifier of the create statement to create an instance of the appropriate class instead of Class::createInstance. For example, suppose you have a local variable called classRef which references the desired Class class instance, and another local variable obj of type Object, the create statement would look similar to the following:
create obj as classRef transient;
Your code would still be generically creating the an instance of the appropriate class without a large if-then sequence and without using any undocumented or hidden methods.
Hope that helps,
Pat.