I was running into an error telling me string was not a type. So I looked up on here and found out that std::string name; to be in the header, but when I compile the program it tells me that name was not declared in the scope.
here is my code for the header:
#ifndef INMATE_H
#define INMATE_H
#include <iostream>
#include <string>
class Inmate
{
public:
Inmate();
int getID();
std::string getName();
//int getHeightFt();
//int getHeightInch();
void setID(int x);
//void setName():
//void setHeightFt();
//void setHeightInch();
private:
int idNumber;
std::string name;
//int heightFt;
//int heightInch;
};
#endif // INMATE_H
and this is my cpp file code
#include "Inmate.h"
#include <iostream>
#include <string>
using namespace std;
Inmate::Inmate()
{
cout << "What is the inmates name"<<endl;
cin >> name;
}
void Inmate :: setID(int x){
idNumber = x;
}
int Inmate :: getID(){
return idNumber;
}
string getName(){
return name;
}