From: NOSPAMsl AT psycode DOT com (Gili) Newsgroups: comp.os.msdos.djgpp,gnu.gcc.help,comp.os.os2.programmer.misc Subject: C++ constructor problem solved!! Read how, it might come in useful in your future programs! Date: 18 Jan 1998 17:37:22 GMT Organization: Generation.NET Lines: 30 Message-ID: Reply-To: NOSPAMsl AT psycode DOT com NNTP-Posting-Host: portC59.Generation.NET Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Here is a quick review of the problem: File() is a class which inherites publicly from fstream() (in other words, "class File : public fstream") We want to be able to call the base constructor of fstream() when the constructor of File() is called. We know we can do this in this fashion: File::File(): fstream() { } However, we wanted to be able to call the base constructor from the body of the File() constructor. This would allow more flexibility, mainly allowing you to use exception-handling for this call. The solution took me 2 days to find, but here it is: File::File() { ((fstream*)this)->fstream(); } Many thanks to Peter Nielsen and Calvin French for their help... Gili