Error question

so below is the error I am getting. I have been working on my own since Friday to research and correct it and I am no closer now than I was Friday. anyone able to help?

1
2
3
4
5
6
7
8
9
10
Library.cpp:42:28: error: no matching function for call to ‘Book::setRequestedBy                          (std::string&)’
   btemp->setRequestedBy(pID);
                            ^
Library.cpp:42:28: note: candidate is:
In file included from Patron.hpp:6:0,
                 from Library.cpp:3:
Book.hpp:37:10: note: void Book::setRequestedBy(Patron*)
     void setRequestedBy(Patron*);
          ^
Book.hpp:37:10: note:   no known conversion for argument 1 from ‘std::string {ak                          a std::basic_string<char>}’ to ‘Patron*’



this is the method I am working in with in the class
this and the next code are in different files However I have included the headers as needed in each header.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
string Library::checkOutBook(string pID, string bID)
{
   for(int i = 0; i < holdings.size(); i++)
   {
      Book* btemp = holdings.at(i);
      if(bID != btemp->getIdCode())
      {
	 return "Book Not Found";
      }
      else if(btemp->getLocation() == CHECKED_OUT)
      {
	 return "book already checked out";
      }
      else if(btemp->getLocation() == ON_HOLD_SHELF)
      {
	 return "book on hold for another patron";
      }
      else
      {
	 btemp->setLocation(CHECKED_OUT);
	 btemp->setDateCheckedOut(currentDate);
	 btemp->setRequestedBy(pID);
	 holdings.at(i) = btemp;
	 return "check out successful";
      }
   }


this is the method I am trying to send the pID to.
1
2
3
4
5
void Book::setCheckedOutBy(Patron* COB)
{
   checkedOutBy = COB;
}


I think it's clear enough that the Book::setRequestBy() method accepts a pointer to Patron, not a string.
correct I already knew that. Im not sure of the correction. I have tried to send it a pointed and it still fails.

the method takes 2 strings in. I need to send the pID to the book object that was created and have it store the pID as a string.
Topic archived. No new replies allowed.