So the problem is "Health" was not declared in this scope, I understand why and I think you understand what I want to do, I don't think it possible to do it with "if", is there another way?
thanks for your help
#include<iostream>
class Knight
{
    int health = 10;
};
class Mage
{
    int health = 8;
};
```
int main ()
{
    int player_class;
    std::cin >> player_class;
    if(player_class == 1) Knight player;
    if(player_class == 2) Mage player;
    std::cout << health;
}
 
    