Question about Class Destructor

Hi Everyone,

I wanted to know if you could help me out with something.

If I have a Class that loads a bunch of objects... for example:

House00 = new (CSDL_Setup, "House00.tga", 200,200,10,10);
House01 = new (CSDL_Setup, "House01.tga", 200,200,10,10);
House02 = new (CSDL_Setup, "House02.tga", 200,200,10,10);
House03 = new (CSDL_Setup, "House03.tga", 200,200,10,10);
....
House99 = new (CSDL_Setup, "House99.tga", 200,200,10,10);

in the destructor of the Class, do I need to have a delete for each and every single one of those objects?

delete House00;
delete House01;
delete House02;
delete House03;
....
delete House99;

??????


And if yes why exactly?


Thanks a lot guyz, I really appreciate it.

Cydriic
Yes. Someone has to do it, and your Class is the logical owner.

Read about RAII and smart pointers.
You should study arrays, STL containers and the new[] operator.
You shouldn't need to use new there.
Topic archived. No new replies allowed.