![]() |
| ||
| Struct within Class, Problem with OVERLOADING OPERATORS So the assignment is to create a Sorted Linked List, not doubly, and not using a tail. I am using a SortedListNode Struct in the private area of the SortedList class. I think this is causing problems. I have the logic, and I was on the verge of succeeding, but then I got stuck with this. I never had to overload == or < or > for a Struct item, within a Class. (and one main requirement is that I do not use a helper function within my insert or remove functions) The SortedList will eventually accept a string word, and compare it (while doing insert) to the cur one, to determain where to put it. (for this I am converting it to char, and then doing strcmpi) but the main problem right now is that I think I don't know how to overload the Struct within the Class as a friend. I know there is more than one option, and not use a friend, but I will probably encounter the same problem with the syntax. Here is my code: #include <iostream> |
| ||
| Re: Struct within Class, Problem with OVERLOADING OPERATORS 1) get rid of strcmpi() C function. See my version of the == operator below. 2) add #include <algorithm>for the transform() function 3) The friend function is not part of the class, so it has to reference the SortedListNode by SortedList::SortedListNode #include <iostream> |
| ||
| Re: Struct within Class, Problem with OVERLOADING OPERATORS Quote:
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup 1>C:\Users\Owner\Documents\Visual Studio 2008\Projects\Project1\testing\Debug\testing.exe : fatal error LNK1120: 1 unresolved externals |
| ||
| Re: Struct within Class, Problem with OVERLOADING OPERATORS Hey, its your code, not mine. Where is the main() function ??? Didn't your teacher tell you that every c++ program needs a main() function. |
| ||
| Re: Struct within Class, Problem with OVERLOADING OPERATORS oh my god! LOL I have it, but I forgot to put it in when I used your solution. Im checking it, and soon ill post. THANKS!!!!! |
| All times are GMT -4. The time now is 7:53 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC