I must create a class with its own operator new. This operator should allocate ten objects, and on the eleventh object “run out of memory” and throw an exception.I don't know how to allocate storage in my function operator new for ten object and then to throw an exception.If I put throw statement after returning ::operator new it won't execute.
With keeping track of objects and trowing exception in constructor everything is OK.But I don't know how to throw exception in my overloaded version of operator new .Is it possible?