How can I use g_classPool to store dynamically allocated instances of class A. I should modify class A, that dynamically allocated instances are stored in the memory occupied by g_classPool. Can also someone tell me how can I learn such features. I was thinking to write void* operator new(...).
char g_classPool[1024];
class A
{
public:
A(): m_data(42) {}
~A() {}
int getData() { return m_data; }
private:
int m_data;
};
int main()
{
A* obj = new A();
delete obj;
return 0;
}