'double' to 'const std

cannot convert from 'double' to 'const std::basic_string
its problem with the string material .. error at return material
1
2
3
4
5
6
7
void Greenhouse::setDescription(string material, int storey, double totalArea, double cleanFloorHeight){
	material=material;
	storey=storey;
	totalArea=totalArea;
	cleanFloorHeight=cleanFloorHeight;
}
	


1
2
3
string Greenhouse::getDescription(void){
	return material, storey, totalArea, cleanFloorHeight;
}


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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
  //building.h file

#include<iostream>
#include<string>

using namespace std;

class Building
{
protected:
	string material;
	int storey;
	double totalArea;
	double cleanFloorHeight;

public:
	Building();
	string getMaterial(void);
	int getStorey(void);
	double getTotalArea(void);
	double getCleanFloorHeight(void);
	void displayAllBuilding();
};

class Greenhouse:public Building
{      
public:
	Greenhouse();
	void setDescription(string material, int storey, double totalArea, double cleanFloorHeight);
	string getDescription(void);
};

class Apartment:public Building
{      
public:
	Apartment();
	void setDescription(string material, int storey, double totalArea, double cleanFloorHeight);
	string getDescription(void);
};

class College:public Building
{      	
public:
	College();
	void setDescription(string material, int storey, double totalArea, double cleanFloorHeight);
	string getDescription(void);
};

class Classroom:public College
{      
public:
	Classroom();
	void setDescription(string material, int storey, double totalArea, double cleanFloorHeight);
	string getDescription(void);
};

class Gymnasium:public College
{      
public:
	Gymnasium();
	void setDescription(string material, int storey, double totalArea, double cleanFloorHeight);
	string getDescription(void);
};

class PoliceStation:public Building
{      
public:
	PoliceStation();
	void setDescription(string material, int storey, double totalArea, double cleanFloorHeight);
	string getDescription(void);
};

class Airport:public Building
{      	
public:
	Airport();
	void setDescription(string material, int storey, double totalArea, double cleanFloorHeight);
	string getDescription(void);
};

Building::Building(){}
string Building::getMaterial(void){
	return material;
}

int Building::getStorey(void){
	return storey;
}

double Building::getTotalArea(void){
	return totalArea;
}

double Building::getCleanFloorHeight(void){
	return cleanFloorHeight;
}

void Building::displayAllBuilding(){
	cout << "<-------------------Building------------------->" << endl;
	cout << endl;
	cout << "|1|                 Greenhouse                       " << endl;
	cout << "|2|                 Apartment                        " << endl;
	cout << "|3|                 College                          " << endl;
	cout << "|4|                 Police Station                   " << endl;
	cout << "|5|                 Airport                          " << endl;
	cout << "<--------------------------------------------------->" << endl;
	cout << endl;
	cout << endl;
}


Greenhouse::Greenhouse(){}

void Greenhouse::setDescription(string material, int storey, double totalArea, double cleanFloorHeight){
	material=material;
	storey=storey;
	totalArea=totalArea;
	cleanFloorHeight=cleanFloorHeight;
}
		
string Greenhouse::getDescription(void){
	return material, storey, totalArea, cleanFloorHeight;
}

Apartment::Apartment(){}

void Apartment::setDescription(string material, int storey, double totalArea, double cleanFloorHeight){
	material=material;
	storey=storey;
	totalArea=totalArea;
	cleanFloorHeight=cleanFloorHeight;
}
		
string Apartment::getDescription(void){
	return material, storey, totalArea, cleanFloorHeight;
}


College::College(){}

void College::setDescription(string material, int storey, double totalArea, double cleanFloorHeight){
	material=material;
	storey=storey;
	totalArea=totalArea;
	cleanFloorHeight=cleanFloorHeight;
}
		
string College::getDescription(void){
	return material, storey, totalArea, cleanFloorHeight;
}


Classroom::Classroom(){}

void Classroom::setDescription(string material, int storey, double totalArea, double cleanFloorHeight){
	material=material;
	storey=storey;
	totalArea=totalArea;
	cleanFloorHeight=cleanFloorHeight;
}
		
string Classroom::getDescription(void){
	return material, storey, totalArea, cleanFloorHeight;
}


Gymnasium::Gymnasium(){}

void Gymnasium::setDescription(string material, int storey, double totalArea, double cleanFloorHeight){
	material=material;
	storey=storey;
	totalArea=totalArea;
	cleanFloorHeight=cleanFloorHeight;
}
		
string Gymnasium::getDescription(void){
	return material, storey, totalArea, cleanFloorHeight;
}


PoliceStation::PoliceStation(){}

void PoliceStation::setDescription(string material, int storey, double totalArea, double cleanFloorHeight){
	material=material;
	storey=storey;
	totalArea=totalArea;
	cleanFloorHeight=cleanFloorHeight;
}
		
string PoliceStation::getDescription(void){
	return material, storey, totalArea, cleanFloorHeight;
}


Airport::Airport(){}

void Airport::setDescription(string material, int storey, double totalArea, double cleanFloorHeight){
	material=material;
	storey=storey;
	totalArea=totalArea;
	cleanFloorHeight=cleanFloorHeight;
}
		
string Airport::getDescription(void){
	return material, storey, totalArea, cleanFloorHeight;
}
For basic data types you can only return one from a function, unless you wrap up the required set of data in a structure or class. (or pass in a reference or pointer for each 'out' value you require).

http://www.cplusplus.com/doc/tutorial/functions/

Last edited on
Topic archived. No new replies allowed.