Message-ID: <316C715E.6512@public1.guangzhou.gd.cn> Date: Thu, 11 Apr 1996 11:41:34 +0900 From: Wang TianXing Organization: No Organization MIME-Version: 1.0 To: Kenneth Foo CC: djgpp AT delorie DOT com Subject: Re: typedef struct inheritance -- not possible? References: <828969663 DOT 273snx AT techm DOT pl DOT my> Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: 7bit Kenneth Foo wrote: > > Why can't this work under DJGPP? > It did work under Visual C++ and Turbo C++... > > typedef struct { > int one; > } BASE; > > typedef struct : BASE { > int two; > } DERIVED; > > Is this valid under ANSI C (c++?) ? It's definitely ill-formed under ANSI C. But I can't find any wording in the draft C++ standard that prohibits this. So, VC++ and TC++ may be doing the right thing. Anyway, your problem is easy to solve: struct BASE { int one; }; struct DERIVED : BASE { int two; }; You can even your definition of BASE, but it's a bit stranger. > What I'm trying to do is to derive a class called DERIVED from BASE. > Hopefully, this avoids those silly constructors during creation. > I don't know what silly constructors you are avoiding. Regards, Wang TianXing