共用方式為


編譯器錯誤 C2810

'interface' :介面只能繼承自另一個介面

介面 只能繼承自另一個介面 ,而且不能繼承自類別或結構。

下列範例會產生 C2810:

// C2810.cpp
#include <unknwn.h>
class CBase1 {
public:
  HRESULT mf1();
  int  m_i;
};

[object, uuid="40719E20-EF37-11D1-978D-0000F805D73B"]
__interface IDerived : public CBase1 {  // C2810
// try the following line instead
// __interface IDerived {
   HRESULT mf2(void *a);
};

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