| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hey all devheads,
i have this one piece of coursework which is really annoying me, i was hoping someone on this board could give me a push in the right direction. all help would be much appreciated. I have to convert a structured program to a object oriented program using encapsulation and inheritance. I have a general jist of OOP, but just cant seem to get it together to do the coding required. I've been told it can only hold member functions (except for the main function which should only contain the code to create the first object), and it cant use global variables. I've attached the coding so you can freely browse through it. I hope someone out there can help me with this, hopefully once i get to grips with C++ i can start helping the next lot of newbies! Cheers, Rezanin |
|
#2
|
|||
|
|||
|
I've made some progress since my last post. Ive created 3 main objects, an data storage class, a nodal pointer class, and a linked list class. I've progressed alot further in the programming and i'm starting to get to grips with it, but i'm afraid im still having problems with the program.
I've compiled it with Visual C++ 6.0 standard edition and there were no errors or warnings. When i run the program operational amplifiers are added fine but then when going to display them the program crashes. i've tried to search and ammend this error but cant seem to be able to do it. Any help would be great as time is running out for me (not in a bells of doom ringing kind of way, but u get what i mean). Thanks Rezanin The coding follows... [edit] i've attached the source code file instead as this post doesnt seem to like tabulated pastes [/edit] |
|
#3
|
|||
|
|||
|
You were setting the current pointer to next before you displayed it. Do the assignment at the bottom of the while loop like so.
Code:
void OpAmpsLists::DisplayList()
{
ListNodePtr Current;
OpAmps ShowAmp;
Current = Front->Next;
while (Current != NULL)
{
ShowAmp = Current->OpAmp;
ShowAmp.ShowValues();
Current = Current->Next;
}
}
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > OOP Linked List, Help Needed! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|