How to make multiple classes

Can someone help.I have been struggling with this for hours can't figure it out how to make it work.Here is my code:

#include <iostream>

using namespace std;
class BMWClass{
public:
void SetName(string BMW){
name = BMW;
}
string getName(){
return name;
}
private:
string name;
};




class BMWDoorClass{
public:
void SetName(string BMWDoor){
name = BMWDoor;
}
string getName(){
return name;
}
private:
string name;
};

int main()
{

BMWClass bo;
bo.SetName("Needs repair");
cout <<bo.getName();
return 0;

BMWDoorClass bo;
bo.SetName("Broken door and 4 windows damaged");
cout <<bo.getName();
return 0;




}



You can't declare two variables with the same name within the same scope.
So far, classes BMWClass and BMWDoorClass don't add any functionality to class string. In other words, you could use string instead of your new classes. Hopefully you plan to add functionality to these classes in the future.
Thanks guys you were helpful.
Topic archived. No new replies allowed.