Mail Archives: djgpp/1998/01/19/08:15:58
On Sun, 18 Jan 1998 22:26:02, Erik Max Francis <max AT alcyone DOT com>
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.
- Raw text -