At 10/2/2009 01:56 PM, you wrote: >Hi Rick, >Each time inside the loop, dir object will be created and destroyed. >The first instance will not stay around. It will be destroyed when the first >iteration of the for loop completes. >The dir object is statically created inside the for loop and the life time >and scope of such objects will be local to the block where it is created. >These objects generally gets created on the stack and will be destroyed >automatically when it goes out of scope. >The destructor will be called properly during such destruction. >In this case for each iteration of the for loop, the constructor and >destructor of dir object will be called. > >I feel this is not the best way of doing it. There are lot of other better >ways to do that. >If i am not wrong, i would say that the way dir object is modelled was >wrong. >Instead of creating object every time, it would rather can be created once. >It should expose a public interface for processing different >directory/files. >There are lot of other smart people in this group. I believe they can give >you suggestions on better way of designing it. > >Thanks, >Thanga
Thank you for your thoughts. Initially I put the directory and path names into the process() calling list but changed it later. I could put it back the other way. In fact, that may help with another issue I have of maintaining values across instantiations. ~Rick
