Old problem with performance

Denis Koroskin 2korden at gmail.com
Sun Feb 8 15:50:20 PST 2009


On Mon, 09 Feb 2009 01:24:34 +0300, Derek Parnell <derek at psych.ward> wrote:

> On Sun, 08 Feb 2009 11:13:00 -0800, Walter Bright wrote:
>
>
>> In particular, classes are *meant* to be used as reference types, but
>> the program is trying to treat them as value types. Virtual functions
>> are orthogonal to what value types are - a continuing problem C++
>> programs have is conflating value types with reference types.
>
> In D, what is the recommend technique to derive one user-defined value  
> type
> from another?
>

A mixin, perhaps:

struct Brush
{
    // ...
}

struct ColoredBrush
{
    mixin Brush;

    Color color;
}




More information about the Digitalmars-d mailing list