Creating member vars on the heap, not the stack
- From: JoeB <joe@xxxxxxxxxx>
- Date: Tue, 28 Nov 2006 12:34:08 +0000
Hi,
I have a class that is a singleton. There will only ever be one instance, and it is in scope for the entire duration of the program.
for this reason, i would like the member vars in the class to be stored on the heap, not the stack.
Other than declaring all the members of the class as static, is there another way?
The class its self cannot be declared as static, because that causes the c'tor to be called before main(), which is a definite no-no.
Joe
.
- Follow-Ups:
- Re: Creating member vars on the heap, not the stack
- From: Ulrich Eckhardt
- Re: Creating member vars on the heap, not the stack
- From: Igor Tandetnik
- Re: Creating member vars on the heap, not the stack
- Next by Date: Re: Creating member vars on the heap, not the stack
- Next by thread: Re: Creating member vars on the heap, not the stack
- Index(es):
Relevant Pages
|