You haven't told the compiler what a vector is, so it considers it an unknown type and goofs-up.
Either add a using std::vector; somewhere at the top, or say std::vector <Car*> foo();
Hope this helps. (Isn't it annoying when the silly stuff gets you?)
[edit] BTW, the header file should also #include <string> #include <vector>
and not rely on the using program to do it for you.
Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229
Some notes:
1. Use const std::string& parameters where possible (everywhere in this class). Return const std::string& from getLname and getFname members .
2. Car* sellCar(Car *carPtr); - extremelly unsafe member. You made car list (vector) private (that's OK) but allow user to sell any Car from the outer world via pointer. Return const vector<Car*>& from getCars.
3. female == true, I agree. But this fact may be not so evident for tired out programmers. Better add enum Sex { Male, Female }; in the class declaration.
4. Add const modifier to all proper member functions, use inline definition where possible. For example:
int getAge() const { return age; }
const std::string& getFname() const { return fname; }
5. What's personName parameter in buyCar member? Consider a possible use case for the Person class: we have person1 and person2, person1 sell a car to person2. You may get Car* pointer from person1 but where is arguments for person2.buyCar() in that case?
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348