Connecting Tech Pros Worldwide Help | Site Map

templated class

  #1  
Old March 24th, 2007, 03:15 PM
Vincent RICHOMME
Guest
 
Posts: n/a
Hi,

I would need some help to write a templated function or method.
I am developping a GUI and on one plateform I am using a listbox
(CListBox) while on the other it's a combobox(CCombobox).
Both controls derived from a the same base class CWnd like this :

class CComboBox : public CWnd
{
....
int AddString(LPCTSTR lpszString);
}

class CListBox : public CWnd
{
....
int AddString(LPCTSTR lpszItem);
}


in my dialog I would like to write a method that take a CComboBox or a
CListBox and call the AddString method.



class CMyDialog : public CDialog
{
// take a CListBox or CCombobox
template<typename TList>
int AddListEntry(Tlist& List, LPCTSTR tszText, DWORD dwItemData);


void OnInitDialog()
{
AddListEntry(ListCtl, "eze", 0);
}



#ifdef PLATFORM1
CCombobox m_ListCtl;
#else
CListBox m_ListCtl;
#endif
};





How can I do that ?
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get a templated class to determine template argument list on it's own? Jim Langston answers 4 May 6th, 2007 12:05 PM
Specialization of a method of a templated class __PPS__ answers 6 August 5th, 2005 07:25 PM
Inherited member name qualification for templated class Lionel B answers 4 July 23rd, 2005 04:06 AM
template member functions of a templated class Jon Wilson answers 9 July 23rd, 2005 12:31 AM
Templated class constructor question ferdinand.stefanus@gmail.com answers 2 July 23rd, 2005 12:03 AM