I am just new to C++, so bear with me. Inside my class, MyArena, I made a vector of pointers, fighters, of another class, Fighter. With this vector, I am collecting Fighter pointers and calling functions for them. But I keep getting errors for fighters.
#include <vector>
using namespace std;
class Fighter;
class MyArena {
vector<Fighter*> fighters;
int current_size = 0;
bool MyArena :: addFighter(string info){
for (int i = 0; i < 11; i++){
if (fighters[i]->getName() == n) //error that "point to incomplete pass type is not allowed?"
isLegit = false;
}
fighters.push_back(new Fighter(n, t, mH, st, sp, m)); //"Fighter" is incomplete type?
return true;
}
bool removeFighter(string name){
for (int i = 0; i < 11; i++){
if (fighters[i]->getName() == name)//error that "point to incomplete pass type is not allowed?"
fighters[i] = NULL;
}
}
};
How should I approach this?
Fighteris not defined. Move the member function definitions out of the header and into a.cppfile.Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readersSee: How to create a Minimal, Complete, and Verifiable example.