The one argument errors mean, that you implemented something as a method but forgot to adjust the number of parameters accordingly.
PolyClass::operator+ is a clear indication its not a friend but a method.
Main Topics
Browse All TopicsSo I'm learning about operator overloading in class, and I totally get the concept, but I'm having syntax issues and such. Here are the methods that aren't compiling. First, I was under the impression you should have 2 different operator[] overloads for assignment and read only. It's says however
/home/falmarri/Dropbox/Pro
/home/falmarri/Dropbox/Pro
And then I get several of these:
/home/falmarri/Dropbox/Pro
I was told that errors like that suggest that I've forgotten to make that method a friend function. But I've included it as a friend like I know how. It may not be correct.
/home/falmarri/Dropbox/Pro
I can post more information if needed, I'd prefer not to post all my source though. I'm assuming it's just fundamental misunderstanding of how this works.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
>>Return type is not part of the prototype
Hi Let_Me_Be can u plz tell me more about this
Lets I'm going to write prototype of a function which accepts two ints and returns int
I should write int Fun(int, int) as the prototype.
Shall I write Fun(int, int) as the prototype?
My Ans: No.
Possible in C but not at _all_ in C++ which is strictly prohibited.
So how can I omit the return type????? How can I say it's not part of the prototype?
Plz let me know if I'm missing something...
Hi
Plz have a look on http://en.wikipedia.org/wi
A function prototype in C or C++ is a declaration of a function that omits the function body but does specify the function's name, arity, argument types and return type.
Thanks,
Subrat
Business Accounts
Answer for Membership
by: Let_Me_BePosted on 2009-10-30 at 00:03:25ID: 25700596
It is what it says int& operator[] (const int lhs); and const int operator[] ( const int lhs); cannot be in a class together. You probably meant int operator[] ( const int lhs) const; instead of const int operator[] ( const int lhs);