I'm just going over classes but I get this error which stops me blank. I've looked through other threads but no clue what's wrong with my code? I've commented the code which is the issue.
class myClass { //Class which might cause an issue? Don't see whats wrong with it.
public:
myClass(string nm) {
setName(nm);
}
void setName(string x) {
name = x;
}
string getName() {
return name;
}
private:
string name;
};
int main() {
cout << "Task 1, Task 2, Task 3, Task 4 ?" << endl;
int answer;
cin >> answer;
switch (answer)
{
case 1://Practising Classes
CRectangle area;
cout << "Enter two numbers \n";
cin >> area.x;
cin >> area.y;
cout << "Area is: "<< area.findArea() << endl;
break;
case 2://Practising Classes
AddNumbers myObj1;
myObj1.getNumbers();
cout << myObj1.addNumbers() << endl;
case 3: //Practising Classes
birthdays b1;
cout << "Welcome to Birthdays! \n";
bool bool1 = false;
do {
cout << "Do you want to enter some data (1) or retrieve some? \n";
int answer;
cin >> answer;
switch (answer)
{
case 1:
b1.setdata();
break;
case 2:
b1.getdata();
}
} while (bool1 == false);
case 4: // This causes the error. // Testing out Constructors
myClass object("David");
myClass object2("Amy");
cout << object.getName();
}
system("PAUSE");
}