KOALAC.H
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:2k
源码类别:

Windows编程

开发平台:

Visual C++

  1. /*
  2.  * KOALAC.H
  3.  *
  4.  * Definition of the Koala object using containment, Chapter 2
  5.  * Included only from KOALAC.CPP.
  6.  *
  7.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  8.  *
  9.  * Kraig Brockschmidt, Microsoft
  10.  * Internet  :  kraigb@microsoft.com
  11.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  12.  */
  13. #ifndef _KOALAC_H_
  14. #define _KOALAC_H_
  15. class CImpIAnimal_K;
  16. typedef CImpIAnimal_K *PCImpIAnimal_K;
  17. class CImpIKoala_C;
  18. typedef CImpIKoala_C *PCImpIKoala_C;
  19. class CKoalaC : public IUnknown
  20.     {
  21.     friend CImpIAnimal_K;
  22.     friend CImpIKoala_C;
  23.     private:
  24.         DWORD           m_cRef;         //Object reference count
  25.         PCImpIAnimal_K  m_pImpIAnimal;  //Interface implementation
  26.         PCImpIKoala_C   m_pImpIKoala;   //Interface implementation
  27.         IAnimal        *m_pIAnimal;     //From Animal
  28.     public:
  29.         CKoalaC(void);
  30.         ~CKoalaC(void);
  31.         BOOL Init(void);
  32.         //IUnknown members, non-delegating
  33.         STDMETHODIMP         QueryInterface(REFIID, PPVOID);
  34.         STDMETHODIMP_(DWORD) AddRef(void);
  35.         STDMETHODIMP_(DWORD) Release(void);
  36.     };
  37. typedef CKoalaC *PCKoalaC;
  38. class CImpIAnimal_K : public IAnimal
  39.     {
  40.     private:
  41.         DWORD       m_cRef;         //For debugging
  42.         PCKoalaC    m_pObj;         //Back pointer
  43.     public:
  44.         CImpIAnimal_K(PCKoalaC);
  45.         ~CImpIAnimal_K(void);
  46.         //IUnknown members
  47.         STDMETHODIMP         QueryInterface(REFIID, PPVOID);
  48.         STDMETHODIMP_(DWORD) AddRef(void);
  49.         STDMETHODIMP_(DWORD) Release(void);
  50.         //IAnimal members
  51.         STDMETHODIMP Eat(void);
  52.         STDMETHODIMP Sleep(void);
  53.         STDMETHODIMP Procreate(void);
  54.     };
  55. class CImpIKoala_C : public IKoala
  56.     {
  57.     private:
  58.         DWORD       m_cRef;         //For debugging
  59.         PCKoalaC    m_pObj;         //Back pointer
  60.     public:
  61.         CImpIKoala_C(PCKoalaC);
  62.         ~CImpIKoala_C(void);
  63.         //IUnknown members
  64.         STDMETHODIMP         QueryInterface(REFIID, PPVOID);
  65.         STDMETHODIMP_(DWORD) AddRef(void);
  66.         STDMETHODIMP_(DWORD) Release(void);
  67.         //IKoala members
  68.         STDMETHODIMP ClimbEucalyptusTrees(void);
  69.         STDMETHODIMP PouchOpensDown(void);
  70.         STDMETHODIMP SleepForHoursAfterEating(void);
  71.     };
  72. #endif _KOALAC_H_