Anyone can teach me how to implement the get and set method in qt ?

Qt Code:
  1. //HEADER FILE
  2. public:
  3. explicit PatientGui(QWidget *parent = 0);
  4.  
  5. ~PatientGui();
  6. QString ID;
  7.  
  8.  
  9.  
  10. QString getID() const;
  11. void setID(const QString &value);
  12.  
  13. //CPP FILE
  14. QString PatientGui::getID() const
  15. {
  16. return ID;
  17. }
  18.  
  19. void PatientGui::setID(const QString &value)
  20. {
  21. ID = ui->nric->text();
  22. }
  23.  
  24. //IN THE NEXT GUII WANT TO PASS DATA TO
  25.  
  26. ui->Patientidentifier->setText(getID());
To copy to clipboard, switch view to plain text mode 

I gotten this error"error: undefined reference to `Infusion::getID()'"

Can anyone tell me what I did wrong ? I think the way i do iot is wrong , please teach me how to implement it correctly