System programming in D (Was: The God Language)
Walter Bright
newshound2 at digitalmars.com
Wed Jan 4 16:53:14 PST 2012
On 1/4/2012 3:21 PM, bearophile wrote:
>> The only reason to use classes in D is for polymorphic behavior - and that
>> means virtual functions.
>
> I don't agree, in some cases I use final class instances instead of
> heap-allocated structs even when I don't need polymorphic behaviour just to
> avoid pointer syntax (there is also a bit higher probability of destructors
> being called, compared to heap-allocated structs). In some cases I've used a
> final class just to be able to use a this() with no arguments :-)
There's no reason to avoid pointer syntax, because D has:
1. ref types
2. automatic dereferencing of pointers
More information about the Digitalmars-d
mailing list