I have a problem with my program... I have a class A, and class B and C that inherit from class A... they live inside another class called Game, like this:
class Game {
public:
Game(bool something);
//all the other functions
private:
A a;
}
I do it like this because I don't know beforehand if the object will be a class B or C, so I declare it like A and then:
Game(bool something) {
if (something) { a = B(); }
else (something) { a = C(); }
}
Now my problem: In the program I ask weather 'a' is B or C... and I want that if its B, run a function than only B has and neither A nor C have. But, of course, the compiler don´t let me do it because it thinks a is a class A object. Does anybody knows how to fix this?