編譯器錯誤 C2862
'interface' :介面只能有公用成員
受保護和私人成員只能從其他成員函式存取。 這類成員不會在介面中使用,因為它可能不會為其任何成員提供實作。
下列範例會產生 C2862:
// C2862.cpp
// compile with: /c
#include <unknwn.h>
[object, uuid="60719E20-EF37-11D1-978D-0000F805D73B"]
__interface IMyInterface {
HRESULT mf1(void); // OK
protected:
HRESULT mf2(int *b); // C2862
private:
HRESULT mf3(int *c); // C2862
};