"operator" overloading?

%u mail at home.com
Wed Feb 23 06:08:24 PST 2011


Hi everyone,

Was hoping someone could help me make sense of this bit of C++ code:

class canvas
{
    operator HDC() { return _hdc; }
protected:
    canvas(HDC hdc): _hdc(hdc) {}
    HDC _hdc;
}

>From what I understand, HDC is an alias for HANDLE in Windows. So
they are overloading canvas such that when assigned to handle
instance it returns _hdc? How is this done in D?

Thanks


More information about the Digitalmars-d-learn mailing list