Classes Error

I need help in creating a header file for these particular classes but i donot know how to do them, please help me.
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
#include <iostream>
using namespace std;
class Engine {       
  public:             
	stringstream engineModel = "T-"2983.88;        
	string ModelType = "Toyota";
	int ModelYear = 2014;
	};
class Wheel {       
  public:                    
	int WheelSize = 17;
	string WheelType = "Mercedes";
	};
class Door {       
  public:                    
	string Color = "White";
	stringstream DoorForCar = "Merceedes-"2014"-Model-"1283;
	};
class Car: {       
  public:                    
	stringstream enginetype = "T-"2983.88;
	int Doorstype = 4;
	int wheelstype = 4;
	
	};
Last edited on
So what could be the problem? The compiler errors (line 5,17,19,21) / missing #include <sstream>?
- Why is engineModel a stringstream instead of just a string? You can't assign to a stringstream like that. How are you planning on using this class?
- "T-"2983.88 is not a valid string or number - it's some frankenstein thing in-between them.
- You generally should not put "using X" declarations in the global part of a header file because then you force the user of that header to pollute the global namespace.
Topic archived. No new replies allowed.