A stupid, obvious user memory leak
#endif /* __GOODCLASS_H__ */
pointer = new int[1024]; // 4kb memory
// delete the allocated memory
// we leak 1000 * 4kb memory.
With each new object of class “good” created and not deleted, we leak at least 4kb of memory. Each time we overwrite the pointer with the pointer to the new object, we leave the previous object behind. There is no way to get back at the old one.
Pretty obvious, but you see it from time to time.