[I'm assuming that your code compiles; i.e. Csprite
is the base class]
Since you've used new
separately on each element, you need to use delete
separately on each element:
delete psprites[0];
delete psprites[1];
delete psprites[2];
The comma notation that you've used in delete psprites[0, 1, 2];
doesn't do what you think it does. 0, 1, 2
is just an expression with value 2, so all you're doing is deleting the final element.
As the array psprites
is stack-allocated, you don't need to delete that. In fact, to do so would be undefined behaviour.
One more thing, you need to ensure that Csprite
has a virtual destructor, or you'll leak memory. You can do that by writing virtual ~Csprite(){}
in its class declaration.