In trying to make a simple emergency room simulation I'm having some errors compiling. I want an array of PatientType objects as a private member of my ArrayType class where I initialize it in ArrayType's default constructor but I'm getting "In file included from errors" just by including ArrayType.h in it's .cpp and also in ArrayType.h it doesn't know what a PatientType object is.
To shorten the post I've removed several methods from ArrayType and most of main but I thought this would accomplish creating a new ArrayType object and adding a PatientType object to its array, still doesn't work =/
ArrayType.h:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#ifndef ARRAYTYPE_H
#define ARRAYTYPE_H
usingnamespace std;
class ArrayType {
public:
ArrayType();
~ArrayType();
void addPatient(PatientType P);
private:
PatientType ERList;
int SIZE;
int numPatients;
};
#endif
#ifndef ARRAYTYPE_H
#define ARRAYTYPE_H
#include "PatientType.h"
//using namespace std; //this would pollute anything that includes it
class ArrayType {
public:
ArrayType();
~ArrayType();
void addPatient(PatientType P);
private:
PatientType ERList;
int SIZE;
int numPatients;
};
#endif
main.cpp
1 2 3 4 5 6 7 8 9 10 11
#include "ArrayType.h"
#include "PatientType.h"
usingnamespace std; //no problem to put it here, it would only affect this tu
int main(int argc, char** argv) {
ArrayType ER; //creating an object using the default constructor
PatientType newP("some", "some", "some", 75, 10, 30); //creating an object using a non-default constructor
ER.addPatient(newP);
return 0;
}