i have following code, i am starting a college project and need help

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
class ba146{

private:
	int capacity;
	int totalSeatWindow;
	int totalSeatAisle;
	int totalSeatMiddle;	

public:
	string timeOfArrival;
	string timeOfDeparture;
	string departureCity;
	string arrivalCity;
	string flight;
	string seatType;
	int occupiedSeatWindow ;
	int occupiedSeatAisle;
	int occupiedSeatMiddle;

	ba146(){						//Constructor
	
		capacity=120;
		totalSeatWindow=40;
		totalSeatAisle=40;
		totalSeatMiddle=40;
		occupiedSeatWindow=0;
		occupiedSeatAisle=0;
		occupiedSeatMiddle=0;
	};	
	int freeSeat(){
		
		return capacity-(occupiedSeatWindow+occupiedSeatAisle+occupiedSeatMiddle);
	}
	
	
	
};
int main(int argc, char* argv[])
{
	printf("Hello World!\n");
	ba146 fly;
	fly.timeOfArrival="Dublin\n";
	
	cout<<fly.timeOfArrival;
	
	cout<<fly.freeSeat;
	
	return 0;
}

but it gives me a warning , and doesnt print out the 120 like i thought it should.

>cout<<fly.freeSeat;
freeSeat is a function. Even if there are no arguments, you still need the (empty) parameter list:

cout<< fly.freeSeat() <<'\n';

Change this line: cout<<fly.freeSeat; to this: cout<<fly.freeSeat(); Remember that freeSeat is a function ;).

Edit: I guess Narue was faster :)

thanks a lot for quick reply, it works . really amatuer mistake but i will get lot of them. java seems so simple compare to c++, maybe thats why they say java is kinder garden stuff

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.