Translating parts of WTL to D

Lionello Lunesu lio at lunesu.remove.com
Thu May 18 03:40:31 PDT 2006


How would you translate this class to D:

#class _U_MENUorID
#{
#public:
#  _U_MENUorID(HMENU hMenu) : m_hMenu(hMenu)
#  { }
#  _U_MENUorID(UINT nID) : m_hMenu((HMENU)(UINT_PTR)nID)
#  { }	
#  HMENU m_hMenu;
#};
#void testfunc( _U_MENUorID x = 0U ){}

The straightforward translation would be:

#class _U_MENUorID
#{
#public:
#  this(HMENU hMenu) { m_hMenu=(hMenu);
#  }
#  this(UINT nID) { m_hMenu=(cast(HMENU)cast(UINT_PTR)nID);
#  }	
#  HMENU m_hMenu;
#}
#void testfunc( _U_MENUorID x = null ){}

but it's not quite as usable as the C++ version.

Any ideas?

L.



More information about the Digitalmars-d-learn mailing list