Nulling a reference to a class with opAssign ...

Mike vertex at gmx.at
Fri Dec 7 11:53:54 PST 2007


Erm ... this totally catched me off guard ...

class Foo()
{
     Bar barRef;
     ~this() { barRef.noMoreFoo(); }
     void opAssign(float f);
}

class Bar()
{
     Foo fooRef;
     void setFoo(Foo foo) { fooRef = foo; }
     void noMoreFoo()     { fooRef = null; } // error: can't cast void* to  
float ...
}

?

-Mike

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


More information about the Digitalmars-d-learn mailing list