Hi all,
I have a class, called Directory, that
opens/closes/reads/writes/displays/etc file directories. I use it in
an application that allows me to search for information, and the user
can search multiple directories for information.
Here is a small snipet of code that I use:
for (int iy = 0; iy < fileLevel; ++iy)
{
Directory dir(dirname, fileNames[iy]);
dir.process();
}
My question is, since I define "Directory dir(dirname,
fileNames[iy]);" within my loop, what happens with
construction/destruction of the "dir" object? Will the first instance
stay around and be overwritten by the next? Will it's memory become
deallocated? Will the destructor run before creating the next instance?
Lastly, is there a better way to do this? An array of Directory objects, maybe?
Thank you,
~Rick