Compiler Error C2862
'interface' : an interface can only have public members
Protected and private members may be accessed only from other member functions. Such members are no use in an interface, since it may not provide implementations for any of its members.
The following sample will generate 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
};
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for