Re: Unions, structure and inheritance
* Juha Nieminen:
I think that you can even pre-declare a type as a struct and implement
it as a class, and it will work at least in some compilers. I don't
know, however, if that's standard behavior. (Is it?)
Yes it is, but at least MSVC warns about it.
At the syntax level there is a difference between 'class' and 'struct', namely
in template formal parameter definitions, where you can (and in the case of a
parameter that itself is a template must) use the keyword 'class'.
Bjarne wrote a book about the rationale of the C++ design decisions, and when or
if I get rich I think that's one book I'll definitely buy. For now though, it's
mostly thrillers and science fiction. Actually now re-reading my old library,
currently Nancy Kress "Beggars in Spain" (interestingly the plot starts in
"future" 2008 :-) (but as an even more off-topic note, re-reading old Asimov and
Heinlein, as of 2008 starships, naturally, had all-male crews, so even though
programming hasn't changed much since 1950 and Windows is still struggling with
national character support we've come some way regarding gender issues) ).
Cheers & hth.,
- Alf