From: Claus Fischer Newsgroups: comp.os.msdos.djgpp,comp.os.os2.programmer.misc,gnu.gcc.help Subject: Re: C++ problem -- Over 30 people were unable to help me, can you?! Date: 19 Jan 1998 10:18:51 -0800 Organization: Intel Corporation Lines: 41 Message-ID: References: <34c01654 DOT 0 AT news DOT cadvision DOT com> NNTP-Posting-Host: tcadcs6.sc.intel.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Calvin French wrote: > I understand your problem. I think, basically there are two things you could > try. The first I would try (well actually maybe I'd cut right to the second > because I'm an impatient little hack) is to call the constructor with > File::fstream(), maybe that alternative will do what you want. I've had so I encountered a necessity of explicitely calling a constructor some time ago and looked up why it did not work. The ARM says that for class A { A() {} } class B : A { A::A(); } or for any other explicit use of a class constructor, a temporary object of that class is constructed; even something like class B : A { ((A*) this)->A(); } would fail for the same reason (ARM section 12.1). My ANSI draft standard of 1996 is unfortunately not very elaborate on the point of explicit constuctor calls; it seems that just not mentioning the ability to explicitely call a constructor bans its usage, and the fact that the syntax for the explicit constructor call is already used for type conversions means anytime you do something like the above it will result in creating a temporary, but not manipulating B. -------------- Not speaking for Intel. Claus Fischer