Struct inheritance

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 24 10:22:05 PST 2015


On Tue, 24 Feb 2015 12:05:50 +0000, amber wrote:

> Hi,
> 
> Is it possible in D to have inheritance using value types, i.e. structs?
> 
> Also I don't quite understand how copy ctors work in D. Do I need to
> implement opAssign(S other) {}, or this(this) {} and what's the
> difference between these two?
> 
> Thanks,
> Amber

p.s. sometimes compiler can use "move" instead of "copy" for structures. 
in this case it will not call postblit. so if you have some fields in 
your struct that depends of the structure address... you're in trouble.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150224/5787949e/attachment.sig>


More information about the Digitalmars-d-learn mailing list