Why can't I inherit (extend) structs?

Lionello Lunesu lio at lunesu.remove.com
Tue Oct 10 07:50:26 PDT 2006

I like the definition of 'struct' in D: simple aggregations of data. But 
is there currently a way to extend a struct? Apart from composition, 
that is. I'd like to do something like this:

struct X {
   int x;
struct Z : X {
   int z;

Would this feature add complications that I fail to see?

It's not a big deal, since I can use composition, but I'll have to name 
a member for the first struct and repeatedly write it.. And I'm lazy :S


More information about the Digitalmars-d-learn mailing list