Re: single class instance question

John Smith <[email protected]>
Newsgroups gmane.comp.windows.off-topic
Message-ID <[email protected]>
unmanaged C++  (not .NET, C# or anything relatively "new")

I found a method that seems to be working. I created my class and used a
private constructor along with a public accessor method that returns a
pointer to the class only if one has not already been created. If a pointer
has already been created, the accessor method returns that pointer instead
of creating a new one.

 I ran some tests on the code and compared various things like the address
of the 'this' pointer for the class and the address of the pointer being
returned by multiple instances of the class and the information matched
everywhere it would be expected to match, so it looks like this will work
for what I need.

Thanks to everyone who offered advice on this problem.



On 6/20/10, John Elliot <[email protected]> wrote:
>
>
>
> John Smith wrote:
> > The problem is that I can still call functions in the class through the
> > second instance, even after the destructor has been called on it.
>
> What language are you programming in?
>
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.