Mail Archives: djgpp/1996/04/10/23:49:50
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
- Raw text -