On 2015-04-16 01:32, bitwise wrote:

One reason is that casting with multiple inheritance offsets the
pointer, and I forget exactly virtual inheritance works, but I'm sure it
breaks things too..

In D I would assume this would eventually be possible:

class Foo { int a; }
class Bar : Foo { int b; }

Foo f = new Bar;

auto offset = typeid(f).getMemeber("b").offset;
auto ptr = cast(int*)(cast(void*)f + offset);
*ptr = 4;

--
/Jacob Carlborg

Reply via email to