From: Ian Chapman Newsgroups: comp.os.msdos.djgpp Subject: Re: SWORD??!! Date: Fri, 07 Feb 1997 14:52:43 -0400 Organization: Nortel Technology Lines: 46 Message-ID: <32FB7A4F.1FD6@nortel.ca> References: <32F784B5 DOT 3358 AT cam DOT org> NNTP-Posting-Host: bkanm382.bnr.ca Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp You are lucky, lots of replies to your post. I asked why the first example did not compile and did not get a reply. At least K.A.R.L. got it to work. I'd be interested in any comments. Regards Ian #include // --- class TObject1 definition class TObject1 { public: TObject1(); virtual void foo(); }; TObject1::TObject1() { foo(); } void TObject1::foo() { printf("TObject1::foo\n"); } // --- class TObject2 definition class TObject2 : public TObject1 { public: TObject2(); virtual void foo(); } TObject2::TObject2() : TObject1() { } //************* ERROR return type spec for constructor invalid. void TObject2::foo() { printf("TObject2::foo\n"); } void main(void) { TObject1 *O1; //*******Warning return type for main changed to integer type. TObject2 *O2; printf("TObject1 creation : "); O1=new TObject1(); printf("TObject2 creation : "); O2=new TObject2(); // delete O2; delete O1; }