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

Windows编程

开发平台:

Visual C++

  1. /*
  2.  * ANIMAL.H
  3.  *
  4.  * Definition of the aggregatable CAnimal object.
  5.  * Included only from ANIMAL.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 _ANIMAL_H_
  14. #define _ANIMAL_H_
  15. class CImpIAnimal_A;
  16. typedef CImpIAnimal_A *PCImpIAnimal_A;
  17. class CAnimal : public IUnknown
  18.     {
  19.     friend CImpIAnimal_A;
  20.     private:
  21.         DWORD           m_cRef;         //Object reference count
  22.         IUnknown       *m_pUnkOuter;    //Outer unknown, no AddRef
  23.         PCImpIAnimal_A  m_pImpIAnimal;  //Interface implementation
  24.     public:
  25.         CAnimal(IUnknown *);
  26.         ~CAnimal(void);
  27.         BOOL Init(void);
  28.         //IUnknown members, non-delegating
  29.         STDMETHODIMP         QueryInterface(REFIID, PPVOID);
  30.         STDMETHODIMP_(DWORD) AddRef(void);
  31.         STDMETHODIMP_(DWORD) Release(void);
  32.     };
  33. typedef CAnimal *PCAnimal;
  34. class CImpIAnimal_A : public IAnimal
  35.     {
  36.     private:
  37.         DWORD       m_cRef;         //For debugging
  38.         PCAnimal    m_pObj;         //Back pointer
  39.         IUnknown   *m_pUnkOuter;    //Outer unknown, for delegation
  40.     public:
  41.         CImpIAnimal_A(PCAnimal, IUnknown *);
  42.         ~CImpIAnimal_A(void);
  43.         //IUnknown members
  44.         STDMETHODIMP         QueryInterface(REFIID, PPVOID);
  45.         STDMETHODIMP_(DWORD) AddRef(void);
  46.         STDMETHODIMP_(DWORD) Release(void);
  47.         //IAnimal members
  48.         STDMETHODIMP Eat(void);
  49.         STDMETHODIMP Sleep(void);
  50.         STDMETHODIMP Procreate(void);
  51.     };
  52. #endif _ANIMAL_H_