Hello,
I'm having trouble compiling a header file for a class written in C++. What's so frustrating is that I can't see what I'm doing wrong. when I compile the code I get the the following 2 errors for lines 22 and 25:
expected ';' before '<' token
ISO C++ forbids declaration of 'vector' with no type
In line 22 I want to return a vector of pointers to a class Car. And in line 25 I am trying to declare a class member to be a vector of pointers to class Car. But I don't understand why I would place an extra ';' on those lines. And I thought that I was declaring vectors of Car* properly by using the syntax vector<Car*>.
Below is the entire header file can anyone spot what I am doing wrong?
#ifndef PERSON_H
#define PERSON_H
using std::string;
class Car;
class Person {
public:
Person();
Person(int ag, bool sx, string fn, string ln);
~Person();
int getAge();
std::string getName();
std::string getFname();
std::string getLname();
bool getSex();
void buyCar(string personName, int year, string carModel);
Car* sellCar(Car *carPtr);
void listCars();
vector<Car*> getCars();
private:
vector<Car*> carsOwned;
int age;
std::string fname;
std::string lname;
bool sex; // true = femaie, false = male
};
#endif