clear initializing constructor

Saaa empty at needmail.com
Mon Aug 4 13:18:52 PDT 2008


Thanks for your reply.
But I think  I wasn't clear in my question.
As _Eigen can get quite large I think it is necessary to have something 
like:

apple=new Fruit(color=RED,rotten=false);

otherwise thinks like this will happen:

apple=new Fruit(,,,RED,,false,,true etc.);





>
> class Fruit
> {
>
>    protected struct _Eigen
>    {
>       byte color = GREEN;
>       bool rotten = false;
>    }
>
>     private _Eigen eigen;
>
>     this()
>     {
>     }
>
>     this(bool rotten, byte color)
>     {
>          eigen.rotten = rotten;
>          eigen.color = color;
>     }
> }
>
> auto apple = new Fruit( false, RED );
> auto normal = new Fruit(); 




More information about the Digitalmars-d-learn mailing list