override - Pass more parameter in overriding new operator(C++) -
I
Class new operator in C ++ by following the instructions given on CMyclass I want to override {public: CMyClass (BOOL bUseWhichMemManager); Zero * operator new (size_t); Zero operator delete (zero *); }; I create two memory managers called CMemManager1 and CMemManger2, using different algorithms to assign buffers.
I try to add constructor to a parameter bUseWhichMemManager, but there is no way to access the parameters in the overridden new function. Is there a way for the new operator to pass more parameters such as:
zero * operator new (size_t size, BOOL bUseWhichManager); thanks
You can pass parameters for the allocation function New expression in this way: New (b) CMyClass / new expression in ie operator new Assuming that the new announcement of your operator has as the member of CMyClass as the following announcement is possible, say "B" to "B" Passed "twenty-which manager" passes your question:
Zero * operator new (siz E_t size, BOOL bUseWhichManager); (Do not put parameters in the constructor, as this is probably not the case.)
Comments
Post a Comment