Multiple Inheritance of Classes

Dee Girl deegirl at noreply.com
Tue Aug 12 11:05:00 PDT 2008


superdan Wrote:
> below's an attempt at an answer.
> 
> first i repeat what is already known. d does do multiple inheritance thru interfaces. it doesn't do multiple inheritance of implementation. better put doesn't do multiple inheritance of data. why? simple. d is a fixed layout language. means that the offset of any data member within the object is known during compilation. with mi it is impossible to lay out objects in a fixed layout. unless you do it the nonsensical way c++ does. at least you can't lay out with 1-dimensional memory. (i've done vlsi design and sure as shit 2-dim helps a lot. but a lot more could be done with 3-dim. i remember only adding two layers was a huge deal.) with mi from n classes you'd need n-dimensional ram. that's why only simple inheritance is possible with 1-dimensional ram. if u want fixed layout that is. (now that i got into it there was a guy who did 2-class inheritance by storing stuff at positive and negative offsets, thus adding a 2nd dimension.) mi of interfaces is a good thing and putting an int in an interface does not make it evil. just makes it impossible to lay out.

I am impress! The above is true word with word. Without one word maybe ^_^. I did a semester project for data layout with maximum efficient. It is hard! Maybe you talk about this paper: Bidirectional Object Layout. http://citeseer.ist.psu.edu/myers95bidirectional.html There is also follow up paper: Two-Directional Bidimensional Object Layout. http://citeseer.ist.psu.edu/670868.htm Maybe you are talk about the second because it has the negative offset. Thank you, Dee Girl



More information about the Digitalmars-d mailing list