Using template to load scenes

Using template to load scenes

Actually i’m trying to implement inheritance for my scenes, this is a template function member i have in my abstract superclass:

    template <class T>
    inline void load_scene(T scn, cocos2d::Color3B col) {
        T next_scene = scn::create();
        Director::getInstance()->replaceScene(TransitionFade::create(0.5f, next_scene, col));

Each subclass should load another scene using this function, problem is, it won’t to compile.
C2653 error

I’m wondering if i need to cast something?

This is a circular dependency error. Check your headers for something like A needs B but B needs A.

Yes, indeed, that was the problem, a Child class was requesting the Superclass and viceversa.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.