Afgeronde rechthoek: Top of book Afgeronde rechthoek: Managers track Afgeronde rechthoek: Technical track Afgeronde rechthoek: Previous page Afgeronde rechthoek: Home
 

 

 

 

 


Example

The following specifications use C++ classes to define an RCOM component class with a single interface:

C++ view

class CBKEGameControlClass: public IBKEGameControl
{
protected:
  IBKEPlayer*  m_BKEFirstPlayerPtr; // require interface
  IBKEPlayer*  m_BKESecondPlayerPtr; // require interface
  IBKEUserinterface*  m_BKEUserinterfacePtr; // require interface
  int m_InstanceNr;
  int m_CurrentPlayerNr;
  ArrayOf3Int m_PlayBoard[3];
  int m_NrOfCycles;
public:
  CBKEGameControlClass(int InstanceNr = -1, int NrOfCycles = 100);
  virtual HRESULT STDCALL QueryAccessPoint (REFIID riid, LPVOID* ppvObjectPtr);
  virtual HRESULT STDCALL ResetInstance ();
  virtual HRESULT STDCALL CleanupInstance ();
  virtual void STDCALL StartGame (int NrOfCycles);
  virtual bool STDCALL InterpretMove (PositionType Position);
  virtual void STDCALL ControlGame ();
  virtual void STDCALL TriggerPlayer (int* positionPtr);
protected:
  virtual void STDCALL InitializePlayers ();
  virtual void STDCALL NextPlayer ();
  virtual void STDCALL ResetGame ();
  virtual int STDCALL BoardComplete ();
  virtual bool STDCALL CheckWinCondition ();
};

class IBKEGameControl
{
public:
  virtual HRESULT STDCALL QueryAccessPoint (REFIID riid, LPVOID* ppvObjectPtr) = 0;
  virtual HRESULT STDCALL ResetInstance () = 0;
  virtual HRESULT STDCALL CleanupInstance () = 0;
  virtual void STDCALL StartGame (int NrOfCycles) = 0;
  virtual bool STDCALL InterpretMove (PositionType Position) = 0;
  virtual void STDCALL ControlGame () = 0;
  virtual void STDCALL TriggerPlayer (int* positionPtr) = 0;
};

The interface is defined as an abstract class. Such classes have themselves no implementation.

 

 

Afgeronde rechthoek: Top of page Afgeronde rechthoek: Next page