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 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 code will generate C2862:

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

[com, uuid="60719E20-EF37-11D1-978D-0000F805D73B"]
interface IMyInterface {
  HRESULT mf1(void);  // OK  
protected:
  HRESULT mf2(int *b);  // 2862 : An interface may only have public methods
private:
  HRESULT mf3(int *c);  // 2862 : An interface may only have public methods
};