If all Warriors are Enemies and possess all the properties of an enemy, then yes, it makes sense that the Warrior be a subclass of the Enemy.
As noted in some comments, a complex inheritance chain is problematic and asymptomatic due to the poor architecture of the program.
Is there a way to have the Enemy and Warrior defined in the same class where the Warrior is of type Enemy, which is of type Character?
In the inheritance chain that we talked about, Warrior is the type of enemy that is the type of character.
I think you can mislead a class with a file that defines it. You cannot define a class that has two types. You can define several classes inside one .h and implement them inside one cpp file, but by style it is better to define one class in one .h / .cpp pair.
source share