I got a global variable and a function that everytime it's called, it creates an object of type Myclass, and inserts a pointer to that object inside a HashTable.
So, I want that everytime 'insert' is called it creates a new object of Myclass, makes a pointer to it and store that pointer into a hash table.
Something like:
Myclass object;
void insert()
{
    object.doSomething();
    Myclass * ptr = &object;
    HashTable.insert(ptr);
}
But it doesn't work since everytime 'insert' is called it overwrite the previous object.
 
     
    