C++ cast to D cast

BLS nanali at nospam-wanadoo.fr
Sat Sep 22 02:13:27 PDT 2007


Hi, I need some advice regarding "how to translate C++ casts into D" casts.
As you can see the there are a lot within the return Statement.

class CGDI // C++
{
public:
   HDC m_hDC;
public:

   HFONT SelectFont(HFONT hFont)
   {
   return ((HFONT)::SelectObject((m_hDC), (HGDIOBJ)(HFONT)(hFont)));
   }
   HFONT SelectObject(CFont cf)
   {
    if (IsValidHandle())
     return (HFONT) ::SelectObject(m_hDC,(HFONT)cf.GetFont());
     return NULL;
   }
}
I guess :
   return (cast(HFONT)SelectObject(cast(m_hDC), 
cast(HGDIOBJ)cast(HFONT)cast(hFont)));
But it makes no sense to me. Can you offer me some advice ?

Many thanks in advance? and sorry about my ignorance ...
Bjoern


More information about the Digitalmars-d-learn mailing list