Screen transition in cocos2d-x using C++

Hello Guys,
I am making one game where I have to implement main menu and then other parts of game. On launch my game will show main-menu on clicking of play-button game will start and so on for different buttons. So here I have to make transitions…let us say between two screen first is main menu and other is game screen. I took two classes mainMenu.cpp and GameScreen.cpp and inherited them from CCLayer and in static scene() method,I am returning the scene of respective class.

Here is the code:

here I am returning Scene from my pauseMenu class:

CCScene* pauseScene::scene()
{
    // 'scene' is an autorelease object
    CCScene *scene = CCScene::create();
    // 'layer' is an autorelease object
    pauseScene *layer = pauseScene::create();
    // add layer as a child to scene
    scene->addChild(layer);
    // return the scene
    return scene;
}

and here I am creating that scene and replacing current scene on the touch event in ccTouchBegan method

if (pauseSprite->boundingBox().containsPoint(tap))
    {
        // create a scene. it's an autorelease object
        CCScene *pScene = pauseScene::scene();
        // run
         CCDirector::sharedDirector()->replaceScene(CCTransitionFade::create(0.5,pScene));

    }

Am I doing it correctly? Please help for the same I am not getting from where should I call or write this scene transition code. When I did above It is giving me error like :

"unknown type name NSString did you mean CString?"  in NSObjcRuntime.h

I have tried few solutions(like adding header files,class forward declarations) from internet it din’t help. I am confused . Any help would be appreciable.

Thanks
Deva

Whenever you are writing any layer for your game,call all the actions for that layer in init(). Also while creating new file,make sure you have selected proper template for your class. When I followed these steps properly,problem was solved for me. Code above I wrote is correct and working fine.