Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Container Class VS Custom Class
Message
From
28/07/1999 20:07:32
 
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00243667
Message ID:
00247470
Views:
23
Ed,

OK - I'm an idiot! you CAN add an instance of an object with the same name as the class using the AddObject method. Sorry for posting incorrect information!

...tim


>>David,
>>
>>I have experimented with this and although you can drop other objects onto a container I have not found how to control the order in which they are created/initialized. Am I missing something or should I not be designing my objects to depend upon a load order?
>>
>>For example I have created an application class and I have dropped eventlog, screen, environment, version, security and user instances onto it. These objects need to share information between each other that could be obtained when they are initialized if it were done in the right order otherwise I have to finish initializing the objects in the Init method of the application class by calling a seperate method in each child object (.User.setUser(),.Version.setVersion()).
>>
>
>Why not add them through the AddObject() method in code in the Init method of the application class; something like:
>
>
SET CLASSLIB TO <i>whatever, where ever</i>
>WITH this
>   .AddObject('User','MyUserClass')
>   .AddObject('Version', 'MyVersionClass')
>   * pass the result of user.getUserID() as a parameter to the Security object
>   .AddObject('Security','MySecurityClass',.user.GetUserID())
>   * etc, etc, etc.
>ENDWITH
>
>It ain't drag and drop, but it does the job and gives you perfect control.
>
>>I this is the preferred method then I can live with it but I am tempted to define my application class in a .PRG so I can order them as I like. What is you approach?
>>
>>...tim
>>
>>>Tim,
>>>
>>>The only real difference is if you are using the Class Designer you can not drop other objects into a Custom class at design time. They can only be added at runtime using the AddObject() method. Container derived objects also have a visual appearance at runtime whereas Custom does not.
>>>
>>>>While browsing various class libraries I noticed the use of the container where I would expect a custom class. Could you explain the advantage of this?
Previous
Reply
Map
View

Click here to load this message in the networking platform