Declaring interfaces with a constructor

XavierAP via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 13 10:52:09 PDT 2017


On Monday, 13 March 2017 at 02:15:21 UTC, David  Zhang wrote:
> What it says on the tin. Is there a way to create interfaces 
> with a constructor or must I use an abstract class.

What do you want to do in your constructor? I can't think of 
anything that wouldn't change some state, either of the class 
(but interfaces aren't allowed to have fields either, precisely 
because they may not have state), or the global state (worse...). 
Just curious.

> Additionally, is there a way to force the linker to link a 
> function in a class without an implementation with another that 
> does have an implementation?

I'm not sure if you mean the same as generating "interface files"?
[1] https://dlang.org/dmd-windows.html#interface-files


More information about the Digitalmars-d-learn mailing list