still having a little trouble with my vector

problem with userMain.BookingsVector[loop].name();

here's the errors:

19 IntelliSense: call of an object of a class type without appropriate operator() or conversion functions to pointer-to-function type c:\users\mike\documents\hw\project3.1\project3.1\project3.1.cpp 213

Error 2 error C2064: term does not evaluate to a function taking 0 arguments c:\users\mike\documents\hw\project3.1\project3.1\project3.1.cpp 213


any suggestions?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class Users{
public:
	Users();
	vector<Bookings> BookingsVector;
	string username;
};

class Bookings{
public:
	Bookings();
	string name;
};

Users::Users(){
};

Bookings::Bookings(){
};

Users userMain;
	Bookings bookMain;



while(loop<userMain.BookingsVector.size()){
	
		cout<<"["<<loop<<"]";
		userMain.BookingsVector[loop].name();
	
	
	loop=loop+1;}
You probably mean line 28. 'name' is not a function, it's a variable. What are you trying to achieve?
overall thing is trying to display all of the booking names so i can then do pop_back and erase.

should i make a function to display names?
Topic archived. No new replies allowed.