Inheriting a C++ class For a COM Object 
Author Message
 Inheriting a C++ class For a COM Object

Hi,

I am new to COM. I have a question regarding multiple inheritance for a COM
object. I've created an ATL object using MS VC++ wizard:-

class ATL_NO_VTABLE CCEquipment :
        public CComObjectRootEx<CComSingleThreadModel>,
        public CComCoClass<CCEquipment, &CLSID_CEquipment>,
        public IDispatchImpl<ICEquipment, &IID_ICEquipment, &LIBID_TEST3Lib>,
        public CAbstractEquipment
{
...

Quote:
}

I want this class to inherit from a C++ generic class 'CAbstractEquipment'
but
I cannot compile this class. The error I have is :-
error C2259: 'CComObject<class CCEquipment>' : cannot instantiate abstract
class due to following members:
        c:\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
CCEquipment> >::CreateInstance(void *,const struct _GUID &, void ** )'

What is the problem? Is there a way for a COM object to inherit from a
generic
C++ class object? If yes, how do I do it?

Thank you in advance.

------------------------------------------------------------
 Get your FREE web-based e-mail and newsgroup access at:
                http://www.*-*-*.com/

 Create a new mailbox, or access your existing IMAP4 or
 POP3 mailbox from anywhere with just a web browser.
------------------------------------------------------------



Sat, 11 Oct 2003 10:26:44 GMT  
 Inheriting a C++ class For a COM Object

Quote:
> What is the problem? Is there a way for a COM object to inherit from a
> generic
> C++ class object? If yes, how do I do it?

Yes. It should just work.

Does your C++ class have any pure virtual functions? (functions with =0
after the declaration). If so, you need to provide an implementation.

As a test, try just writing CAbstractEquipment *p=new CAbstractEquipment. If
this fails to compile with similar errors, it has pure virtual functions
that need implementing in your control.

Christian.



Sat, 11 Oct 2003 18:21:27 GMT  
 Inheriting a C++ class For a COM Object
You omitted the actual error lines, so I cannot tell you your problem,
but it is highly likely a pure virtual function is not resolved...

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:
> Hi,

> I am new to COM. I have a question regarding multiple inheritance for a
COM
> object. I've created an ATL object using MS VC++ wizard:-

> class ATL_NO_VTABLE CCEquipment :
> public CComObjectRootEx<CComSingleThreadModel>,
> public CComCoClass<CCEquipment, &CLSID_CEquipment>,
> public IDispatchImpl<ICEquipment, &IID_ICEquipment, &LIBID_TEST3Lib>,
> public CAbstractEquipment
> {
> ...
> }

> I want this class to inherit from a C++ generic class 'CAbstractEquipment'
> but
> I cannot compile this class. The error I have is :-
> error C2259: 'CComObject<class CCEquipment>' : cannot instantiate abstract
> class due to following members:
>         c:\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
> CCEquipment> >::CreateInstance(void *,const struct _GUID &, void ** )'

> What is the problem? Is there a way for a COM object to inherit from a
> generic
> C++ class object? If yes, how do I do it?

> Thank you in advance.

> ------------------------------------------------------------
>  Get your FREE web-based e-mail and newsgroup access at:
>                 http://MailAndNews.com

>  Create a new mailbox, or access your existing IMAP4 or
>  POP3 mailbox from anywhere with just a web browser.
> ------------------------------------------------------------



Sun, 12 Oct 2003 02:37:33 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Can COM Object inherit and deals with C++ objects

2. Inherit multiple Com Classes into one Com class

3. problems creating a object of a inherited class through base class

4. C++ COM-Object with COM-Object as parameter

5. Inherit unmanaged c++ classes from .Net platform (managed c++ or c#)

6. Inheriting from a COM Object

7. How to inherit COM class correct?

8. Concept Q: Interface inherit object class?

9. Printing VC++ CScrollView inherited class objects

10. Printing VC++ CScrollView inherited class objects

11. Passing a COM object to a non-COM aware class

12. Passing an Excel COM object to a C++ COM Server

 

 
Powered by phpBB® Forum Software