Operator overloading -- lets collect some use cases

Stewart Gordon smjg_1998 at yahoo.com
Tue Dec 30 08:28:24 PST 2008


Christopher Wright wrote:
<snip>
> void main ()
> {
>     auto a = new A;
>     auto b1 = new B(a);
>     auto b2 = new B(a);
>     auto a2 = new A;
>     b1.a += a2; // okay, b1.a is b2.a
>     b1.a = b1.a + a2; // now b1.a !is b2.a
> }

If these comments reflect what the code you posted does for you, your 
compiler is broken.  Here, the code correctly doesn't even compile.

Stewart.



More information about the Digitalmars-d mailing list