Reset class member variables

mandel mandel at foobar.com
Fri Sep 7 14:58:08 PDT 2007


I agree, in many cases it is a design problem
to reset an Object because the problems
introduced by it often outweights the 
speed/memory overhead.

But it's nice when the initializing problem
can be done in a foolproof way.
It's nice not to have to sacrifice speed for reliability.


dennis luehring Wrote:

> mandel schrieb:
> > Hi,
> > 
> > I have some big classes with lots of member variables
> > that need to be reset to theire initial value.
> > Therefore I thought about a more reliable way to
> > accomplish this, because it's hard to keep track
> > of variables I have added.
> > It also looks bloated to assign all values manually.
> 
> what about creating a new object everytime you need a fresh one?
> i think that new is faster than reinitalise all members - and you get 
> rid of your track problems
> (btw: the need of reseting an object could be a design problem)
> 
> ciao dennis




More information about the Digitalmars-d mailing list