I have a class that will process an array of objects of another class that I created earlier (which works fine). The problem occurs when I try to create an object of class List.
This is the title of the list class:
#ifndef personlistH
#define personlistH
#include "Person.h"
#include <iomanip>
#include <iostream>
#define SIZE 10
namespace std {
class PersonList {
private:
Person persons[SIZE];
int arrnum;
string filename;
public:
Personlist();
};
}
#endif
This is the main function:
#include <iostream>
#include "PersonList.h"
using namespace std;
int main() {
PersonList personlist;
return 0;
}
My compiler error:
error: "27 \ PersonList.h ISO C ++ prohibits declaration of` Personlist 'without type "
I was looking for answers, but since I'm pretty new to C ++, this was a bit confusing and I haven't found a suitable one yet. It would be great if you could explain this error to me.
source
share