Jump to content

Hey guys, I've been having trouble with a class as the data for my nodes but it is not working

because the class has not been defined, but when I move the node to after the class definition

anything that uses the root keyword does not work.  Could anyone offer some tips to me? 

functions.cppheader.hmain.cpp

Here is the errors with node above.

9MdOLnq.png?1

 

Here are the errors when it is moved to after. 

CAfjPb5.png?1 

i5 4670k| Asrock H81M-ITX| EVGA Nex 650g| WD Black 500Gb| H100 with SP120s| ASUS Matrix 7970 Platinum (just sold)| Patriot Venom 1600Mhz 8Gb| Bitfenix Prodigy. Build log in progress 

Build Log here: http://linustechtips.com/main/topic/119926-yin-yang-prodigy-update-2-26-14/

Link to comment
https://linustechtips.com/topic/599986-class-and-node-issue/
Share on other sites

Link to post
Share on other sites

i still get all the same errors as the second picture?

i5 4670k| Asrock H81M-ITX| EVGA Nex 650g| WD Black 500Gb| H100 with SP120s| ASUS Matrix 7970 Platinum (just sold)| Patriot Venom 1600Mhz 8Gb| Bitfenix Prodigy. Build log in progress 

Build Log here: http://linustechtips.com/main/topic/119926-yin-yang-prodigy-update-2-26-14/

Link to comment
https://linustechtips.com/topic/599986-class-and-node-issue/#findComment-7789870
Share on other sites

Link to post
Share on other sites

5 hours ago, gabrielcarvfer said:

Try 

  Hide contents


typedef struct Node node;

class tree//Inserts, deletes nodes, displayAll, edit
{
	public:
		tree();
		~tree();
		int insert(char * key_value);//, const tree & toAdd);//Inserts the new entry into the tree.
		int create(char * keyWord, int chapter, char*  notes, int pageNum);// Create a new note entry
		int retrieve(char * keySeach) const;//, tree & found) const;//Allows searching the tree to find a matching keyword, then displays it.
		int edit(char * keySearch, char noteEdit, tree & found);//Edits the notes of a certain passage.
		void displayAll(void) const;//Displays all contents of the external data file.
		void writeout(char * key_value, const tree);//Writes out to external data file.		

	private:
		node * root;
		char * keyword;
		int chapter;
		int pageNum;
		char * notes;
};

struct Node//Data is a single note entry and has two pointers to children.
{
    tree entry;//data
    node * left;
    node * right;
};

 


And remove unnecessary stuff from main. 

That worked! Thank you so much!

i5 4670k| Asrock H81M-ITX| EVGA Nex 650g| WD Black 500Gb| H100 with SP120s| ASUS Matrix 7970 Platinum (just sold)| Patriot Venom 1600Mhz 8Gb| Bitfenix Prodigy. Build log in progress 

Build Log here: http://linustechtips.com/main/topic/119926-yin-yang-prodigy-update-2-26-14/

Link to comment
https://linustechtips.com/topic/599986-class-and-node-issue/#findComment-7790919
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×