I have received the following code that is only supposed to allow the allocation of a string-variable in the class constructor. I have tried many things but always get the following error:
"undefined reference to 'Patient::Patient(std::string)"
Patient.hpp
#ifndef Patient_hpp
#define Patient_hpp
#include <iostream>
#include <string>
using namespace std;
class Patient{
protected:
string name;
public:
Patient(string name);
};
#endif // Patient_hpp
Patient.cpp
#include "Patient.hpp"
Patient::Patient(string name){
this->name=name;
}
Main.cpp
#include "Patient.hpp"
int main(){
Patient p("Mary");
return 0;
}
I would be very grateful for your help.
Best regards