Why are opCall's not implicitely assignable?

Karen Lanrap karen at digitaldaemon.com
Tue Sep 26 01:45:30 PDT 2006


Derek Parnell wrote:
>   mycar.roof = COLOR.RED;
>   mycar.roof = SOFT_TOP;
> 
> Nah ... doesn't make much sense.

Your argument holds for this code too:

import std.stdio;
enum COLOR{RED};
enum TYPE{SOFT_TOP};
class Car{
    void roof( COLOR c)
    {
    }
    void roof(TYPE t)
    {
    }
}
void main(){
    auto mycar= new Car;
    mycar.roof= COLOR.RED;
    mycar.roof= TYPE.SOFT_TOP;
}

Now please explain, why this is nearly senseless.



More information about the Digitalmars-d-learn mailing list