accessing a object that you don't know
Programming with msvc++6, using win32 console app.
Here is my deal.
I am making a menu class so i can easily and quickly insert menus into the programs I make. Have it set up now so I can add a menu to a program with little code (How many items you want to be listed is n, you only have to code n+1 lines. very simple).
You navigate this menu using your arrow keys and select an item by pressing the enter key. Pretty basic setup. Now here is my problem.
I have a class called menu, and a class called menunode. Menu node exisits for each entry in the list. Its members:
and the functions needed to access and alter those items.
int value // holds the place in the list (between 1-last item)
string title // the actual name of the item
Now, the other class, menu, uses a binary search tree as a base and has data members of interest are:
now, what i want to do. Is print the title of the node a special way if the value currently at in the list (held by selection) is the same as the value of the node.
So, enough of the confusing background, can I get menunode the ability to access the variables of functions in menu without having an object?
Here is a little tree:
menu calls the print function of my binary search tree which calls the print function on the menunode.
Can i let my print function in menunode access the functions in menu?