C++ cast to D cast
Bill Baxter
dnewsgroup at billbaxter.com
Sat Sep 22 02:20:30 PDT 2007
BLS wrote:
> 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 ?
I would guess
return (cast(HFONT)SelectObject(m_hDC, cast(HGDIOBJ)cast(HFONT)hFont));
It's just a function call -- SelectObject(m_hDC,hFont)
>
> Many thanks in advance? and sorry about my ignorance ...
Maybe you just need some sleep? :-)
--bb
More information about the Digitalmars-d-learn
mailing list