addTargetDelegate problem


#1

@ void HelloWorld::registerWithTouchDispatcher()
{
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, this->getTouchPriority(), true);

}
@

I’m trying to add touch detection in the standard hello world, but im getting the error:

Ambiguous conversion from derived class HelloWorld to base class cocos2d::CCTouchDelegate

.h file looks like this:
@ #ifndef HELLOWORLD_SCENE_H
#define HELLOWORLD_SCENE_H

#include “cocos2d.h”

using namespace cocos2d;

class HelloWorld : public cocos2d::CCLayer, public CCTargetedTouchDelegate
{

public:
// Here’s a difference. Method ‘init’ in cocos2d-x returns bool, instead of returning ‘id’ in cocos2d-iphone
virtual bool init();

// there’s no ‘id’ in cpp, so we recommend returning the class instance pointer
static cocos2d::CCScene* scene();

// a selector callback
void menuCloseCallback(CCObject* pSender);

//a selector for category selected
void buttonPress(CCMenuItemImage *sender);

//a selector for item selected
void itemSelected(CCMenuItemImage *sender);

//touch controls
// Returns the Cocos2d position of the touch
cocos2d::CCPoint touchToPoint(CCTouch* touch);

/// Returns true if the touch is within the boundary of our sprite
bool isTouchingSprite(CCTouch* touch);

//Users/Developer/Downloads/cocos2d-x-2.2.1/projects/testProject/Classes/HelloWorldScene.cpp
// we are multi-touch enabled, so we must use the ccTouches functions
// vs the ccTouch functions
virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);
virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);
virtual void registerWithTouchDispatcher();
void holdCheck();

// implement the “static node()” method manually
CREATE_FUNC(HelloWorld);

};

#endif // HELLOWORLD_SCENE_H
@