Thread overview
Library inheritance
Nov 04, 2014
Felix
Nov 04, 2014
Adam D. Ruppe
Nov 05, 2014
Felix
Nov 05, 2014
David Nadlinger
Nov 06, 2014
Chris Williams
November 04, 2014
Hi,
just wondering if it's possible, due to the lag of header files, to inherit from some class that exists within a library, that has been written in D?

How did you solve that?

Thanks in advance.
November 04, 2014
A library may provide header files for this, or you can just use the source code itself to import and inherit from.
November 05, 2014
On Tuesday, 4 November 2014 at 15:27:33 UTC, Adam D. Ruppe wrote:
> A library may provide header files for this, or you can just use the source code itself to import and inherit from.

Okay, but that would mean to have the source available. Though
for me it seems like D is attempting to get rid of header files.
But when dealing with, lets say, some D compiled library there
seems to be now way to accomplish something like inheriting as
ELF doesn't provide you with the necessary data.
November 05, 2014
On Wednesday, 5 November 2014 at 23:04:00 UTC, Felix wrote:
> On Tuesday, 4 November 2014 at 15:27:33 UTC, Adam D. Ruppe wrote:
>> A library may provide header files for this, or you can just use the source code itself to import and inherit from.
>
> Okay, but that would mean to have the source available.

You can still use a version of the source code without any of the function bodies (usually ending in .di). Same as in C++, more or less.

David
November 06, 2014
On Tuesday, 4 November 2014 at 15:03:08 UTC, Felix wrote:
> Hi,
> just wondering if it's possible, due to the lag of header files, to inherit from some class that exists within a library, that has been written in D?
>
> How did you solve that?
>
> Thanks in advance.

You can run the compiler to create library and header (.di) files. Anything that requires compile-time execution, like templates, will remain in the .di. Anything that can be compiled as-is, will go in the library and just be represented as a function/method declaration in the .di file.

So, basically, the same as C++ except you don't have to manually write your own header files.