static class vs. static struct

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 26 06:11:31 PST 2015


On Monday, 26 January 2015 at 14:02:54 UTC, ref2401 wrote:
> What's the difference between static class and static struct?
> What should i use?

Non-static structs/classes have an extra pointer. Static ones 
don't have it, so their differences are the usual ones: a class 
is used by reference and they are often on the heap, while a 
struct is handled by value (or pointer to value). A class has two 
extra hidden fields.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list