NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error C2810

'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);
};