C++ operator overloading to D

BLS nanali at nospam-wanadoo.fr
Sat Sep 22 11:29:01 PDT 2007


Hi,
I have a small problem in translating C++ operator overloading to D

// Allready translated C++ stuff
class CFont
{
public:
   HFONT m_hFont;

   this(HFONT hFont = NULL)
   {
     m_hFont = hFont;
   }
   ~this()
   {
     if(m_hFont !is NULL && !DeleteObject(m_hFont))
     m_hFont = NULL;
   }

// TODO How to translate this C++ construct  into D

     operator HFONT() {return m_hFont;}

// That's the problem.

Sorry have  not found anything related in the docs.
Some ideas;;; Many thanks in advance.
Bjoern


More information about the Digitalmars-d-learn mailing list