Why can't I inherit (extend) structs?

Johan Granberg lijat.meREM at OVEgmail.com
Mon Oct 16 09:49:20 PDT 2006


Derek Parnell wrote:
> And I'd go so far as to say that the term 'inheritance' is a bit strong.
> Maybe just 'derivation' as we would be deriving a new struct definition
> from existing definitions, but there is no implied linkage between them at
> runtime. 

If it is just derived from that is wanted wouldn't it bee easier with a 
syntax like this.

struct foo
{
	int b;
	int c;
}
struct bar
{
	int a
	include foo;
	int d
}

the struct bar would now have four fields (a,b,c,d)

this way their is no way to misunderstand it for inheritance and if one 
want a foo* one can always take the addres of the first element.



More information about the Digitalmars-d-learn mailing list