main.cpp:
#include <iostream>
#include "PrintText.h"
#include <string>
using namespace std;
int main()
{
PrintText tOb("Mwhahahaahhaha");
cout << tOb.getText() << endl;
return 0;
}
PrintText.cpp:
#include "PrintText.h"
#include <iostream>
#include <string>
using namespace std;
PrintText::PrintText(string z){
setText(z);
}
void PrintText::setText(string x){
text = x;
}
string PrintText::getText(){
return text;
}
PrintText.h:
#ifndef PRINTTEXT_H
#define PRINTTEXT_H
class PrintText{
public:
PrintText(string z);
void setText(string x);
string getText();
private:
string text;
};
#endif
I'm getting errors saying that string has not been declared and string does not name a type in my .h file and I don't understand why.