benedek
April 27th, 1999, 08:41 AM
Mixing Class Inheritance with Interfaces Inheritance AND ATL
My problem is the following: how can I mix Class Inheritance with
Interface Inheritance and ATL?
The problem seemed quite simple to me:
I have a base class (say CGUI) implementing some virtual function
virtual HRESULT STDMETHODCALLTYPE SomeGUIFunction1()
virtual HRESULT STDMETHODCALLTYPE SomeGUIFunction2()
I create an interface (IGUI) for this class with two functions
(SomeGUIFunction1, SomeGUIFunction2), but I do not map them, they are
completely separated.
I create a third class, which is an ATL object (MyGUI), with it's own
interface (IMyGUI).
It is easy to simply use IGUI as well, but then I have to implement
all the functions in IGUI
The best I could do is to derive MyGUI from CGUI as well, and then
implement ALL the functions listed at IGUI like
HRESULT STDMETHODCALLTYPE MyGUI::SomeGUIFunction1( void)
{
return CGUI::SomeGUIFunction1();
}
It seemed to me that I have to implement explicitly all the functions,
because IGUI exports them as pure virtual functions. Is it true?
/*************************************
d:\program files\microsoft visual
studio\vc98\atl\include\atlcom.h(1827) : error C2259:
'CComObject<class MyGUI>' : cannot instantiate abstract class due to
following members:
d:\program files\microsoft visual
studio\vc98\atl\include\atlcom.h(1823) : while compiling
class-template member function 'long __stdcall ATL::CComCreator<class
ATL::CComObject<class MyGUI> >::CreateInstance(void *,const struct
_GUID &,vo
id ** )'
*************************************/
[I know that out there there is an article on MSDN dealing with almost the same problem. But that one deals only with Mixing Class Inheritance with Interfaces Inheritance and CCmdTarget-derived classes, not with ATL]
Any help would be highly appreciated!!!
Sincerely,
Balazs Benedek
Technical University of Budapest, Hungary
My problem is the following: how can I mix Class Inheritance with
Interface Inheritance and ATL?
The problem seemed quite simple to me:
I have a base class (say CGUI) implementing some virtual function
virtual HRESULT STDMETHODCALLTYPE SomeGUIFunction1()
virtual HRESULT STDMETHODCALLTYPE SomeGUIFunction2()
I create an interface (IGUI) for this class with two functions
(SomeGUIFunction1, SomeGUIFunction2), but I do not map them, they are
completely separated.
I create a third class, which is an ATL object (MyGUI), with it's own
interface (IMyGUI).
It is easy to simply use IGUI as well, but then I have to implement
all the functions in IGUI
The best I could do is to derive MyGUI from CGUI as well, and then
implement ALL the functions listed at IGUI like
HRESULT STDMETHODCALLTYPE MyGUI::SomeGUIFunction1( void)
{
return CGUI::SomeGUIFunction1();
}
It seemed to me that I have to implement explicitly all the functions,
because IGUI exports them as pure virtual functions. Is it true?
/*************************************
d:\program files\microsoft visual
studio\vc98\atl\include\atlcom.h(1827) : error C2259:
'CComObject<class MyGUI>' : cannot instantiate abstract class due to
following members:
d:\program files\microsoft visual
studio\vc98\atl\include\atlcom.h(1823) : while compiling
class-template member function 'long __stdcall ATL::CComCreator<class
ATL::CComObject<class MyGUI> >::CreateInstance(void *,const struct
_GUID &,vo
id ** )'
*************************************/
[I know that out there there is an article on MSDN dealing with almost the same problem. But that one deals only with Mixing Class Inheritance with Interfaces Inheritance and CCmdTarget-derived classes, not with ATL]
Any help would be highly appreciated!!!
Sincerely,
Balazs Benedek
Technical University of Budapest, Hungary