I'm implementing a nested class and trying to implement some related functions in it. But it seems that no way whatsoever it decides to work. Could you please help me as I'm getting really exhausted.

Thanks a lot.


#include <string>
using namespace std;

typedef string dvdTitle;

class stockList
		stockList();	/* Constructor */
		stockList(const stockList& StList);	/* Copy Constructor */
		~stockList();	/* Destructor */

		bool isEmpty() const;	/* Return wether list is empty or not */

		int getLength() const;	/* Return the size of the list */

		void insertTitle(string ID, const dvdTitle newTitle, int year, int want, int have);  /*Insert the item in index) */
		void insertWho(string ID, string who);

		void removeTitle(string ID);	/* Remove the item designated by index */

		void removeWho(string ID);	/* Remove the name from the wait list */

		void retrieve(string ID);	/* Retrieve the item designated by index */

	    struct waitNode // Structure for the costumer information
		string ID;
		string who;
		waitNode *next;

	class stockItem 
		    void setID(string ID);
		    string getID();
		    void setTitle(string title);
		    string getTitle();
		    void setYear(int year);
		    int getYear();
		    void setWant(int want);
		    int getWant();
		    void setHave(int have);
		    int getHave();

		    string ID;
		    string title;
		    int have, want, year;


	struct stockNode  // Main 
	    stockItem item;
	    waitNode *waitHead, *waitTail;
	    stockNode *next;    

	stockNode *head;


and after the class declaration, here is what I have done for my "void insertTitle".

void stockList::insertTitle(string ID, const dvdTitle newTitle, int year, int want, int have)
	stockNode *cur = head;

	for (cur = head; cur != NULL; cur = cur -> next)
		if ((cur -> item).getID() == ID)
			cerr << "Item already existed";


	cur -> next = new stockNode;

	cur->next = NULL;


and when I compile, it says that no reference is defined to stockList::stockNode::getID() or setID() and so forth.

thanks again.

7 Years
Discussion Span
Last Post by __avd

I didn't find any ambiguity in your code. Please justify your code.

Yeah, exactly, that's the problem. It seems that the code should be correct, but it turns out that it doesn't work. As I mentioned before, it just states that no referencing to that function call. I really don't know why....


Method are implemented (defined) in class stockItem.

	class stockItem
		    void setID(string ID) { this->ID=ID;}
		    string getID() {return ID; };
		    void setTitle(string title) { this->title=title;}
		    string getTitle() { return title;}
		    void setYear(int year) {this->year=year; }
		    int getYear() { return year;}
		    void setWant(int want) { this->want=want;}
		    int getWant() { return want;}
		    void setHave(int have) { this->have=have;}
		    int getHave() { return have;}
		    string ID;
		    string title;
		    int have, want, year;
Votes + Comments
Thanks, it was nice
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.