Getters in class don't work. Cannot print data from my class variables

Here's my program. I wrote lots of getters and setters. Also I use inheritance in my code. But I cannot print the variables. I don't want to use overloading output. Can I do that without them?
Here's the mistake: function call missing argument list; use '&School::get_classes' to create a pointer to member

Thanks


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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
  #include "stdafx.h"
#include "iostream"
using namespace std;

class Building
{
	public:
		int floors;
		int rooms;
		double area;

	    void setArea( double are )
		{
			this -> area = are;
		}

		void setFloors( int flo )
		{
			this -> floors = flo;
		}

	    void setRooms( int rom )
		{
			this -> rooms = rom;
		}

		int get_rooms()
		{
			return this -> rooms;
		}

		int get_floors() 
		{ 
			return this -> floors;
		}

		double get_area()
		{
			return this -> area;
		}

		Building()
		{
			floors = 0;
			rooms = 0;
			area = 0;
		}

		/*
		friend ostream &operator<<( ostream &output, const Building &h )
		{ 
			output << h.floors;
			return output;            
		}
		*/
};

class House: public Building {};

class School: public Building
{
	public:
		int classes;

		void setClasses( int cla )
		{
			this -> classes = cla;
		}

		int get_classes() 
		{ 
			return this -> classes;
		}
};

int main( )
{
    House h;
	School s;
	
	int count_of_rooms;
	int count_of_classes;
	int total_area;

	cout << "Enter count of rooms: ";
	cin >> count_of_rooms;

	cout << "Enter count of classes: ";
	cin >> count_of_classes;

	cout << "Enter the area of school: ";
	cin >> total_area;
	
	h.setRooms(count_of_rooms);
	s.setClasses(count_of_classes);
	s.setArea(total_area);
	
	cout << h.get_rooms;
	cout << s.get_classes;
	cout << s.get_area;
	

	return 0;
}
When you call a function you have to put parenthesis after the function name.
Peter87, Thanks a lot
Topic archived. No new replies allowed.