dzeidzei

dzeidzei

  • NA
  • 3
  • 0

Do I need a destructor?

Jun 13 2008 1:52 PM

Hi,

I have application with couple of classes. One class is named CpriorStart containing strings as members for storing data.

Then I have other class named CstartingHorse, having string members as well, but it also contains array for previously mentioned CpriorStart objects. I allocate that array in constructor as follows:

public class CstartingHorse

{

         private CpriorStart[] previousStarts;

         public CstartingHorse()

         {

               previousStarts = new CpriorStart[8];

         }

}

So, do I need a destructor in that CstartingHorse class and if positive, what to do in it?

I also have third class named Crace containing again strings as members. It also contains arraylist member for storing previously mentioned CstartingHorse objects. That arraylist is also allocated in constuctor like:

alStartingHorses = new ArrayList();

If I've got it right, I don't need destructor for this class. Or do I? And again, if positive, what to do in destructor?

Thanks!

-dzeidzei


Answers (4)