hi, I'm new-ish to c++ and I have a program:
and I'm having a dickens of a time trying to figure out why I am getting the error message "primary expression expected before type" in my display message function. I would very much appreciate any help, thank you.
Code:
#include <iostream>
#include <string>
using namespace std;
class Person{
private:
string guysname;
int guysage;
public:
Person (string name, int age)
{
setGuysName(name);
setGuysAge(age);
}
void setGuysName(string name) {
guysname = name;
}
string getGuysName()
{
return guysname;
}
void setGuysAge(int age)
{
guysage = age;
}
int getGuysAge(string type)
{
if (type == "coolguy")
{
return guysage - 5;
}
if (type == "weirdo")
{
return guysage;
}
return 0;
}
void displayMessage()
{
cout <<"yo' name is: " << getGuysName() << " and you are " << getGuysAge(string type ) << endl;
}
};
int main()
{
Person a("bob", 30);
return 0;
}
and I'm having a dickens of a time trying to figure out why I am getting the error message "primary expression expected before type" in my display message function. I would very much appreciate any help, thank you.