I am doing a project where I recreate Pokémon in C++ and currently I am in the process of implementing moves.
My implementation is currently:
#pragma once
class Pokemon;
class MoveBase
{
public:
void use(Pokemon* target)
{
target->setHealth(damage);
}
private:
int damage;
};
where my thought-process is that I need a target pointer (pointer that points to the pokémon which the move will be used on) so that I can properly decrease the HP of the target pokémon accordingly. However, I do not want the circular dependency if I include the Pokemon-class so I forward declare Pokemon which I thought should've worked, but I just get
use of undefined type 'Pokemon' at line 10
I am relatively new in C++ and would like to know what is wrong with this code snippet. Did I forward declare incorrectly?