![]() |
|
#1
|
|||
|
|||
C++ class -- Please helpHello everybody. I got this assignment. I've been trying to solve it for a week but to no avail. Please help me.
Quote:
This is the header file of the List class CPP / C++ / C Code:
This is the given implementation file of the List class CPP / C++ / C Code:
This is the new class that I've been trying to write, but I just don't know how to use them in the List class Header file: CPP / C++ / C Code:
Please help. I've been working with this like crazy. Thanks. Last edited by cable_guy_67 : 13-Jun-2006 at 14:29.
Reason: Changed PHP code tags to C++ code tags
|
|||
|
#2
|
|||
|
|||
Re: C++ class -- Please helpFirst of all, to get correct syntax highlighting for C/C++, use the [ c++ ] tags instead of the [ php ] tags.
On to your question. I think you need to change the typedef string ItemType; line in the List header file to typedef your Status class as the List's type. (NOTE: because of the List class's internal processing, you will need to add an operator!= (not equal to) overload in your Status class, plus an operator= (assignment) and an operator< (less than). The standard STL string class already does this, which is why it compiles in the List class without errors.) After you make the List use the Status class, you'll need to build a program interface around the List to change the status of the item etc as per the project description. NOTE #2: To prevent perplexing errors later, I would change the List's GetNextItem() function to return an ItemType& (by reference, that is) instead of an ItemType by value, because if you GetNextItem by value (in other words, copy the item from the List's data array) and then change the status, the item that the List knows about will not change. So you need to keep a reference directly to the List's data array in order to modify it. |
|
#3
|
|||
|
|||
Re: C++ class -- Please helpThank you very much. A friend helped me to modify the program that way, and it works now.
I'm just an amateur in C++, and I really want to be really good at it. Do you suggest me anything? Thanks again. BB. |
|
#4
|
||||
|
||||
Re: C++ class -- Please helpRead lots of programming books. Use online tutorials. Take programming classes. Write a lot of code. The last one was the most useful for me. I'm trying to write a game right now, and every time I need to figure out how to do something new, I online, take a tutorial, and learn it. The only book I use is "Learn C++ in 21 Days" by Jesse Liberty. I think it's an excellent guide and reference.
Gamer_2k4 |
Recent GIDBlog
Toyota - 2009 May Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| a tester class and then some. | postage | Java Forum | 1 | 06-May-2006 16:48 |
| Opinion on my code and a c++ class question | FlipNode | C++ Forum | 7 | 07-Feb-2006 09:15 |
| Error C2146: syntax error : missing ',' before identifier 'C4' | mattchew008 | C++ Forum | 2 | 19-Dec-2004 07:06 |
| Help! Some basal questions about MFC | xutingnjupt | MS Visual C++ / MFC Forum | 1 | 05-Dec-2004 04:38 |
| hashing help | saiz66 | C++ Forum | 1 | 06-Jul-2004 07:16 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The