How to pass a parameter in Cocos2d-X

I need to call a function by passing some parameter. Like:

-(void)initBalls:(CCSprite *)node withFirstEdge:(int)a secondEdge:(int)b withFirstDirection:(float)c secondDirection:(float)d{
//some code
}

- (id)init {

    if ((self=[super init])) {

        srandom(time(NULL));
        [self initBalls:balloonSprite withFirstEdge:10 secondEdge:20 withFirstDirection:1.2f secondDirection:2.1f];
    }
    return self;
}

But I didnt find any way to do that in cocos2d-X. Can anyone help me about it??

Thanks in advance.

You can override bool init() function, and invoke initBalls in it.

[Hero heroWithGame:self]

How can i pass self in Hero::heroWithGame() in cocos2d-x

Hero->heroWithGame(this)

Although I am not sure exactly what you want.

Jobed Rony wrote:

Hero->heroWithGame(this)
>
Although I am not sure exactly what you want.

Hi,

in Cocos2d

This is constructor of my HeroContactListener:

HeroContactListener(Hero* hero) { _hero = [hero retain]; }
and in my Hero class:

contactListener = new HeroContactListener(self);

When i port it to cocos2dx, i cant replace self to this, because i have this error:
No matching constructor for initialization of 'HeroContactListener'