|
-
July 12th, 2006, 08:37 AM
#3
Re: design issue with static vars
The Singleton pattern maybe the answer.
Your contructor example earlier has the cnst as static, this would make the outer object static as well as it's 2 member variables.
I shouldn't lose any data , if the member objects are static then no matter how many times new is called on the outer object the member vars same instance should still remain! isn't that correct?
I initialize the statics in the Init() func if the static is null, but the real population of the static is only done later. The real popultation is done later with 2 seperate function calls, one for each static.
so the outer object instance is created and 2 static instances of the static objects are created. The xml files are later read in and populate the statics with the Xml file data. The data is not lost but there are 2 problems, the constructor is called each time even though the Init() is only called if the instance of _xmldoc is null, also
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|