Why can't I inherit (extend) structs?
Derek Parnell
derek at nomail.afraid.org
Tue Oct 10 21:24:17 PDT 2006
On Tue, 10 Oct 2006 23:26:01 -0400, Jarrett Billingsley wrote:
> "rm" <roel.mathys at gmail.com> wrote in message
> news:egh0bu$2155$1 at digitaldaemon.com...
>> Lionello Lunesu wrote:
>>> It's not a big deal, since I can use composition
>>
>> but mixin' it in, works nicely
>
I know I'm just dreaming but it would be very nice-to-have if one could do
this ...
struct Color
{
ubyte Red;
ubyte Green;
ubyte Blue;
}
struct Pixel extends Color
{
ubyte Alpha;
}
Pixel Z
Z.Red = 80;
Z.Blue = 125;
Z.Green = 0;
Z.Alpha = 128;
rather than
struct Color
{
ubyte Red;
ubyte Green;
ubyte Blue;
}
struct Pixel
{
Color color;
ubyte Alpha;
}
Pixel Z
Z.color.Red = 80;
Z.color.Blue = 125;
Z.color.Green = 0;
Z.Alpha = 128;
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
11/10/2006 2:18:29 PM
More information about the Digitalmars-d-learn
mailing list