cocos2d-x 怎么搞虚继承，接口啊

fishw
Sun, 11 May 2014 04:15:54 +0000

#ifndef __IPLAYER_H__
#define __IPLAYER_H__

class IPlayer
{
public:
    ~IPlayer();

    virtual void CreatePlayer() = 0;
};

#endif

#ifndef __IMAPPING_H__
#define __IMAPPING_H__

class IMapping
{
public:
    ~IMapping();

    virtual void CreateMap() = 0;
};

#endif

#ifndef __GAMEMAP_H__
#define __GAMEMAP_H__

#include "cocos2d.h"
#include "IMapping.h"
#include "IPlayer.h"
USING_NS_CC;

class GameMap : public CCLayer, public IPlayer, public IMapping {
public:
    virtual void CreateMap();
    virtual void CreatePlayer();
};

#endif

编译不通过啊，用虚继承这样也是不通过啊
class GameMap : public CCLayer, virtual public IPlayer, virtual public IMapping


```


看源代码实现是宏，命名空间
NS_CC_BEGIN, NS_CC_END, CC_DLL

我们是不是也要这样宏 命名空间 namespace myinterface ?

阅读整个主题