I am new to programming and I am getting an error that I cant track down. im sure that by problem stems from lack of experience but I think the error has to do with my overloaded function in line 7 but everything I change gives me the same error. any help would be very appreciated the error I am getting is
error C2679: binary '>>': no operator found which takes a right-hand operand of type 'overloaded-function' (or there is no acceptable conversion)
#include "RetailItem.h"
#include <iostream>
usingnamespace std;
int main()
{
retailItem r1("shirt", 33, 12.59);
retailItem r2;
retailItem r3;
cout << "Welcome to the retail store!" << endl;
cout << "Price must be greater then 0." << endl;
cout << "Please enter a price for item 1 : ";
cin >> r1.setPrice >> endl;
cout << "Inventory must be greater than 0." << endl;
cout << "Please enter units on hand for item 1 : ";
cin >> r1.setUnits >> endl;
cout << "Please enter the description for item 1 : ";
cin >> r1.setDesc >> endl;
}
r1.setPrice
What is this? Looks like you're kind of trying to call a function but kind of don't know how to call a function and you're also just kind of guessing that maybe you can kind of use cin to kind of ram numbers into calling a function?
I think the error has to do with my overloaded function in line 7
Line 7 is a function? It seems like an object to me.
(btw retailItem r1("shirt", 33, 12.59); should be retailItem r1{"shirt", 33, 12.59}; if you were trying to initialize)
I don't know what you're trying to do, but it seems, like Repeater said, you're trying to 'input' to a member function?..
Maybe you can show us what's in RetailItem.h, if you wrote it, then it might also have some errors. If you didn't write it then I think you don't know how to properly use classes, so read about classes a bit more.
Thank you Repeater I do appreciate your advice. I have gone back over the material and made a few changes to my code. I have not tested it yet because I have additional compiler errors on the getter calls. Please dont correct me on them Im reviewing it now but I would appreciate some advice on if what I fixed looks correct.
Thank you fro your help everyone I was just missing parentheses on the bottom and I added if statements for data verification. again thank you for pointing me in the right direction.