Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
Sorry somehow some text is missing in my previous question. Thanks for bearing with me. Here is complete question-

Working on VS2013.

I have created a classs-

class ATL_NO_VTABLE CMyClass : 
	public CComObjectRootEx <<CComMultiThreadModel>>,
	public CComCoClass<<CMyClass, CLSID_MyClass&>>,
	public IDispatchImpl<<IMyInterface3, IID_IMyInterface3, LIBID_myLib,  1, 0>>,  
        public StdDispatchImpl<<CMyClass>>;

In another cpp file I'm creating instance as follows-

CMyClass::CreateInstance(_pMyClass);

<b>Here I get error, saying:  
error C2385: ambiguous access of 'CreateInstance'
          could be the 'CreateInstance' in base 'ATL::CComCoClass<<CMyClass, CLSID_MyClass>>'
or could be the 'CreateInstance' in base 'StdDispatchImpl<<CMyClass&>>
		  
I need all the base class to derive from for my development purpose.
Kindly advice how to resolve the ambiguity.

If I exclude last line from my class (i.e. public StdDispatchImpl <<CMyClass>>), Compiler will be very happy to compile it successfully.

note: I need to use CreateInstance  from StdDispatchImpl<<CMyClass&>>


Thanks,
Praveen


What I have tried:

google..

I need all the base class to derive from for my development purpose.
Kindly advice how to resolve the ambiguity.
note: I need to use "CreateInstance" from 'StdDispatchImpl<<CMyClass>>'
Posted
Updated 26-Jul-16 19:02pm
v6
Comments
barneyman 27-Jul-16 1:06am    
CMyClass::StdDispatchImpl<cmyclass>::CreateInstance ?

1 solution

Such problems often occur, when you change names after creating such classes. I only can guess, that the naming glue between CMyClass, CLSID_MyClass and IMyInterface3 is broken. Best is creating this files from the scratch again.

Include the error messages of the compiler!!!
 
Share this answer
 
Comments
Praveen0711 26-Jul-16 5:20am    
Sorry somehow some text is missing in my previous question. Thanks for bearing with me. Here is complete question-

Working on VS2013.

I have created a classs-

class ATL_NO_VTABLE CMyClass :
public CComObjectRootEx <<CComMultiThreadModel>>,
public CComCoClass<<CMyClass, &CLSID_MyClass>>,
public IDispatchImpl<<IMyInterface3, &IID_IMyInterface3, &LIBID_myLib, 1, 0>>,
public StdDispatchImpl< CMyClass >


In another cpp file I'm creating instance as follows-

CMyClass::CreateInstance(&_pMyClass);

Here I get error, saying:
error C2385: ambiguous access of 'CreateInstance'
could be the 'CreateInstance' in base 'ATL::CComCoClass<<CMyClass,&CLSID_MyClass>>'
or could be the 'CreateInstance' in base 'StdDispatchImpl<<CMyClass>>'


I need all the base class to derive from for my development purpose.
Kindly advice how to resolve the ambiguity.

If I exclude last line from my class (i.e. public StdDispatchImpl< CMyClass >), Compiler will be very happy to compile it successfully.

note: I need to use "CreateInstance" from 'StdDispatchImpl<<CMyClass>>'


Thanks,
Praveen

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900