On Tuesday, 25 May 2021 at 17:52:14 UTC, Gavin Ray wrote:

```d
void main()
{
  Derived dlangDerived = new Derived(123);
printf("[D] Derived.Base1::getSomething() = %d \n", dlangDerived.getSomething()); printf("[D] Derived.Base2::getOtherThing() = %d \n", dlangDerived.getOtherThing()); printf("[D] Derived.Base1::inheritedFunctionWithArgs(5, 10) = %d \n",
      dlangDerived.inheritedFunctionWithArgs(5, 10));
  printf("[D] Calling C++ takesADerived() with D Derived* \n");
  takesADerived(dlangDerived);
}
```
![output](https://i.imgur.com/Plbtlow.png)


That last one with someInt is what I warned about. D ctor messed up class layout, in this simple case where class data isn't used it almost works, but will be practically unusable in real scenarios.

Reply via email to