From: beaver AT reksoft DOT ru (Slava Jarki) Newsgroups: gnu.gcc.help,comp.os.os2.programmer.misc,comp.os.msdos.djgpp Subject: Re: C++ constructor problem solved!! Read how, it might come in useful in your future programs! Date: 19 Jan 1998 07:45:50 GMT Organization: REKSoft Lines: 30 Message-ID: References: <34C2817A DOT 5547BE86 AT alcyone DOT com> NNTP-Posting-Host: 194.8.172.152 Mime-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Sun, 18 Jan 1998 22:26:02, Erik Max Francis wrote: > Erik wrote: > > Explicitly calling constructors is dangerous. Here what's _really_ > happening is that the fstream is being constructed with the default > constructor, and _then_ you're explicitly calling a nondefault > constructor. That is, it's functionally precisely the same thing as: > > File::File(...): > fstream() > { > ((fstream *) this)->fstream(...); > ... > } > > This is unwise and can have unwanted side effects, particularly if > memory is being allocated in the default constructor (because then it > will get allocated twice). > Ok I am agree, but constructor not allocate memory for object. It adjust VMT. Best luck. Slava Jarki.