structs inheriting from and implementing interfaces
thedeemon
dlang at thedeemon.com
Fri Dec 29 12:43:01 UTC 2017
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote:
> Is that simply because it hasn't been implemented or suggested
> yet for D, or was there a deliberate design decision?
It's a design decision.
Look carefully at structs vs. classes here:
https://dlang.org/spec/struct.html
There is no virtual methods table (VMT) for structs, no
inheritance. Structs have value semantics. A variable with a type
of some interface implies it's a pointer, with reference
semantics and a VMT.
More information about the Digitalmars-d-learn
mailing list