Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP COM Design Problem
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01214563
Message ID:
01215113
Views:
15
>That's in interesting approach, however it requires
>that the name of the calling class be hardcoded into the
>code in the child.

Having no type information to query in VFP, there is not much else to do. You can always make it more generic and have some metadata or use a constant (#include) with a string containing all the Class.Method combinations which are authorized to instantiate the child class.

>So, the only way that an instance of Child could be
>returned is through ParentClass.GetChildClass, so no other
>methods could return one.

My guess is that if you want to use a Factory, the best should be that it is present in just a single point, but if you want to have more than one factory around, you can use the "ClassA.Method;ClassB.Method" approach and check if the caller is i the list.

>However, all said, I do like it better than a public var.

Yes, having no access code security, you can do your own poor-man version of it this way... 8-)
Previous
Reply
Map
View

Click here to load this message in the networking platform