c++ - Controlling object creation -


I have a class whose object should be created on the pile. Is there a better way to do this than this:

  class A {public: static A * createInstance (); // Allocate new use and static zero removal process (A *); // Use memory to destroy private: // Constructor and district is private so that the object can be made on stack A (). ~ A (); };  

This is a very standard pattern for creating an object heap.

Actually can not be very simple, except that you can only make the manufacturer without using a factory method without making any devastating personal.


Comments