C++ cast to D cast
BLS
nanali at nospam-wanadoo.fr
Sat Sep 22 02:31:51 PDT 2007
Bill Baxter schrieb:
> 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
Thanks Bill. Yep, need more coffee
Bjoern
More information about the Digitalmars-d-learn
mailing list