Trouble with inheritance and function

Hi, I encountered little problem while programing. I've made it little simpler and have such code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void might::use(mastermind &game, chosenOne &hero, might *power, gameplay &play){

        int level;
        cin >> level;

        if(hero.getMana() < power->getMana(level-1)){
            cout << "You dont have enought mana\n";
        }
        else{
            effect(game, hero, level, play); //all arguments
        }
    }
}


and few virtual functions in this base and one of it in inhired clases. In simple something like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class might
{
public:
   void use(mastermind &game, chosenOne &hero, might *power, gameplay &play)
   virtual void effect(mastermind &game, int level)
   virtual void effect(chosenOne &hero, int level)
   virtual void effect( gameplay &play)
}

class moreTrys : public might
{

public:
    virtual void effect(mastermind &game, int level);
};

class heal : public might
{
public:
    virtual void effect(chosenOne &hero, int level);
};

class escape : public might
{
public:
    virtual void effect(gameplay &play);
};



and the problem is with the effect function is there a way to create it nicly so it would use the right effect function with right arguments in something like

1
2
escape getaway;
getaway.use(one, two, three, four);


I thought about creating: virtual void effect(gameplay &play,chosenOne &hero,int level,mastermind &game); but in classes functions don't use those all argument and it would be a really waste and bad practice, also thought about else if for classes but it dosen't seam to be good idea either.
Topic archived. No new replies allowed.