Re: G++ and constructors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Note:

I put in the init_instance() presuming you wanted to do some extra work in
there -- such as whatever lock() and unlock() are doing.

If you don't need to do any extra work, then you can collapse it to the
simpler:

----------------------------------------------------------------------
myclass* myclass::get_instance() // public: static
{
  static myclass* instance = new myclass;
  return instance;
}
----------------------------------------------------------------------

Sorry if I previous more complicated example caused confusion.

--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux