C++ rtmp livestream 流媒体

海阔天空 张翼飞翔

我的学习笔记。--我喜欢这里,因为这里安静,无广告骚扰。
随笔 - 82, 文章 - 2, 评论 - 126, 引用 - 0
数据加载中……

二个类相互访问 类申明

 

在头文件里提前声明另一个class,不要包含另一个的头文件,放在cpp里包含。   
  //CMap.h  
  #ifndef   _CMAP_H_  
  #define   _CMAP_H_   
  class   CPlayer;  
  class   CMap  
  {  
        CPlayer   *m_Players[10];   
  }  
  #endif   
  //CPlayer.h  
  #ifndef   _CPLAYER_H_  
  #define   _CPLAYER_H_   
  class   CMap;   
  class   CPlayer  
  {  
        CPlayer(CMap   *map);   }  
  #endif   
  //CMap.cpp  
  #include   "cmap.h"  
  #include   "cplayer.h"   

  //Cplayer.cpp  
  #include   "cmap.h"  
  #include   "cplayer.h"  

posted on 2008-03-31 12:06 ZhangEF 阅读(98) 评论(0)  编辑  收藏 所属分类: C/C++