hi all. in a recent project i created a linked list to store a students course data...such as course ID, year taken, semester taken, and final grade. This program worked without any problems. now, my next project is to create a stack to store the data, instead of a linked list.
BUT, my assumption is that a stack uses a linked list, so why delete my linked list set up, when i could create a new class and give it the extra functionality needed for a stack, and keep the old linked list class...
So i have done this, and i have come across a slight / large problem. I am getting the following errors when trying to compile my code:
driver.cpp(23) : error C2039: 'linkedStack' : is not a member of 'Student'
student.h(10) : see declaration of 'Student'
driver.cpp(23) : error C2228: left of '.isFull' must have class/struct/union
driver.cpp(32) : error C2039: 'linkedStack' : is not a member of 'Student'
student.h(10) : see declaration of 'Student'
driver.cpp(32) : error C2228: left of '.pop' must have class/struct/union
driver.cpp(56) : error C2039: 'linkedStack' : is not a member of 'Student'
student.h(10) : see declaration of 'Student'
driver.cpp(56) : error C2228: left of '.isFull' must have class/struct/union
driver.cpp(63) : error C2039: 'linkedStack' : is not a member of 'Student'
student.h(10) : see declaration of 'Student'
driver.cpp(63) : error C2228: left of '.pop' must have class/struct/union
1>proj3 - 8 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
So i understand that my driver.cpp doesn't realize that the linkedStack IS a member of student (at least i think i set this correctly). My question is... should i be doing this:
Student.h - line 20:
linkedStack<CourseInfo> courseList;
Changed to this:
SinglyLinkedList<courseInfo> courseList;
but if i do that, then i dont include the information within the linkedStack class, so my function calls to pop/push will not work?!
is there something that i could do that would help make this work? Any ideas? I will post a .zip file with all my code files inside (there are 9+ files, so it is just much easier than you having to download 9+ files seperately!).
Thanks!
Tony