943,863 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2776
  • C++ RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Dec 4th, 2008
0

Re: Need help solving errors: C2533, C2511, C2144.

>>'getShippingCost' is not a member of 'Invoice'

Yes -- you didn't see the code I posted earlier?
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,951 posts
since Aug 2005
Dec 4th, 2008
0

Re: C2511 error - need help solving

I have tried changing them. it backfires every time. is there any way I could supply an explicit conversion?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
acperson is offline Offline
20 posts
since Dec 2008
Dec 4th, 2008
0

Re: Need help solving errors: C2533, C2511, C2144.

Don't create two threads about the same problem. I merged your two threads and don't intend to do it again!
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,951 posts
since Aug 2005
Dec 4th, 2008
0

Re: Need help solving errors: C2533, C2511, C2144.

oh. sorry. I'm just really trying to get this done in time. I had 5 due tonight (with only 1 1/2 weeks to do them) and I only have 3 completely finished. The last one isn't getting done because I don't have time to type the code up and then compile it and debug. So I need this one to be as good as it can...

sorry about that...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
acperson is offline Offline
20 posts
since Dec 2008
Dec 5th, 2008
0

Re: Need help solving errors: C2533, C2511, C2144.

>>
Yes -- you didn't see the code I posted earlier?
Is this in response to supplying an explicit conversion? Because if so, I'm still doing something else wrong because i have the same thing in the code box you provided.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
acperson is offline Offline
20 posts
since Dec 2008
Dec 5th, 2008
0

Re: Need help solving errors: C2533, C2511, C2144.

The print() method doesn't need a parameter at all.

This time read all the code and correct the spelling as I did.

Invoice.cpp
C++ Syntax (Toggle Plain Text)
  1. void Invoice::print()
  2. { //print values in current bill
  3. cout<<"Invoice Number: "<<getInvoiceNum()<<endl<<endl;
  4. cout<<"Part Number: "<<getPartNum()<<endl;
  5. cout<<"Part Description: "<<getPartDesc()<<endl;
  6. cout<<"Quantity Shipped: "<<getQuantityShip()<<endl;
  7. cout<<"Unit Price ($/item): "<<getUnitPrice()<<endl;
  8. cout<<"Sales Tax Rate: "<<getSalesTaxRate()<<endl;
  9. cout<<"Sales Tax Amount: "<<calcSalesTaxAm()<<endl;
  10. cout<<"Shipping Cost: "<<getShipCost()<<endl;
  11. cout<<"Total Cost: "<<calcTotCost()<<endl;
  12. }

invoice.h
C++ Syntax (Toggle Plain Text)
  1. void print();

main.cpp
C++ Syntax (Toggle Plain Text)
  1. if (bill[place].getInvoiceNum() == inum)
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,951 posts
since Aug 2005
Dec 5th, 2008
0

Re: Need help solving errors: C2533, C2511, C2144.

Thanks for replying and all the help you've given me thus far!

Well, when I do that I get 9 occurrences of the same error - one per line.

c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.cpp(114) : error C2662: 'Invoice::getInvoiceNum' : cannot convert 'this' pointer from 'const Invoice' to 'Invoice &'
Conversion loses qualifiers
Reputation Points: 10
Solved Threads: 0
Newbie Poster
acperson is offline Offline
20 posts
since Dec 2008
Dec 5th, 2008
0

Re: Need help solving errors: C2533, C2511, C2144.

in main you call print() on an Invoice object just like you call getInvoiceNum() or one of the other plublic methods.

bill[place].print();

assuming you've changed the print() method to have a void parameter list.
Reputation Points: 718
Solved Threads: 373
Nearly a Posting Maven
Lerner is offline Offline
2,253 posts
since Jul 2005
Dec 5th, 2008
0

Re: Need help solving errors: C2533, C2511, C2144.

Ok, fixed that one. That was my fault for not checking my code exactly. I left const in the .h file.

But...now I'm back to that blasted C2511 error.

c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.cpp(113) : error C2511: 'void Invoice::print(void) const' : overloaded member function not found in 'Invoice'
c:\documents and settings\tina\my documents\visual studio 2008\projects\csci112lab4\csci112lab4\invoice.h(14) : see declaration of 'Invoice'
Reputation Points: 10
Solved Threads: 0
Newbie Poster
acperson is offline Offline
20 posts
since Dec 2008
Dec 5th, 2008
0

Re: Need help solving errors: C2533, C2511, C2144.

Did you update the declaration of print() in the .h file and the definition of print() in the .cpp file to correspond with the new signature of print()?
Reputation Points: 718
Solved Threads: 373
Nearly a Posting Maven
Lerner is offline Offline
2,253 posts
since Jul 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: C++ graphics
Next Thread in C++ Forum Timeline: Inheritance, and code not running





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC