Creating member vars on the heap, not the stack

Tech-Archive recommends: Fix windows errors by optimizing your registry



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

.



Relevant Pages

  • Re: Is VB Caca??
    ... It warns you because you are declaring a variable in the scope that hides a variable with the same name with a larger scope. ... Mike Ober. ... Dim s As String ...
    (microsoft.public.dotnet.languages.vb)
  • Untold(...) variable scope in ASP.NET
    ... We all know that declaring a variable as 'Public' gives it global ... scope over the application, nothing new... ... I usually dont like to create session variable because i found them ... scope goes beyong the user session, actually you are better off using ...
    (microsoft.public.dotnet.languages.vb)
  • Re: working example File::Taill
    ... A> Couldnt this be a disadvantage in big projects, where declaring ... A> criables at the top of the appropriate scope allows ppl to find *all* ... reason not to do this. ... but the strong consensus is that it is poor style. ...
    (comp.lang.perl.misc)
  • Re: Suggestion: Python global scope
    ... declaring a variable using the global statement automatically ... variable from the global scope into the current scope. ...
    (comp.lang.python)
  • Re: C 99 compiler access
    ... Declaring a variable in mid-block is a valuable way ... in C99 for /closing/ the scope of a variable with a minimum of clutter. ... scope of 'bar' where I intend. ... ("Okay, here he's defining 'bar'. ...
    (comp.lang.c)