Compiler Error C2810 (Windows CE 5.0)

Send Feedback

'interface' : an interface can only inherit from another interface

An interface may only inherit from another interface and may not inherit from a class or struct.

For example, the following code generates a C2810 error:

// compile with /cl /c
#include <unknwn.h>
#undef interface
#pragma keyword("interface", on)

class CBase1 {
public:
  HRESULT mf1();
  int  m_i;

};

[com, uuid="40719E20-EF37-11D1-978D-0000F805D73B"]
interface IDerived : public CBase1 {  // 2810 : cannot inherit from a class
   HRESULT mf2(void *a);
};

struct CBase2 {
   HRESULT mf1(int a, char *b);
   HRESULT mf2();
};

[com, uuid="50719E20-EF37-11D1-978D-0000F805D73B"]
interface IDerived2 : public CBase2 {  // 2810 : cannot inherit from a struct
   HRESULT mf3(double a);
};

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.