![]() |
|
#1
|
|||
|
|||
How to access C++ data structureI am new to C++ and need to know how to access (get/set or read/write) the prompt information from another module. Code and details to follow.
Module A.cc contains a data structure this: CPP / C++ / C Code:
Module A.h contains a data structure this: CPP / C++ / C Code:
Last edited by LuciWiz : 18-Jan-2009 at 12:16.
Reason: Corrected end [/cpp] tag
|
|||
|
#2
|
|||
|
|||
Re: How to access C++ data structureIf you are using a class you do not have access to then you can not access the private members of that class (unless you are supplied a formal way to do so). If you had access to the class you could just implement getters/setters for the data. If not, the only other way to get at the data is to have it declared as protected in the base class and make your own class that is a sub class of inode_state.
__________________
My personal site: Utilities for text processing, debugging, testing and plotting |
|
#3
|
|||
|
|||
Re: How to access C++ data structureApparently the "friend class inode" allows inode to see the private members of inode_state, but not the converse. Therefore, I was informed there is a way to have access to the prompt class member. Please let me know if this makes sense. Again, I am new to C++.
|
|
#4
|
|||
|
|||
Re: How to access C++ data structureLets start over.
What is it you are trying to do? Do you have access to the inode_state class - i.e. can you edit its structure? Do you have access to the inode class - can you edit its structure? If can edit either of the above, it is a trivial task. Otherwise I'm not sure you will be able to do what you want (if I understand it correctly). __________________
My personal site: Utilities for text processing, debugging, testing and plotting |
|
#5
|
|||
|
|||
Re: How to access C++ data structureHello L7Sqr,
Thanks for being patient with me. I can access the inode_state and inode_class. I do not want to. So without change the .h and .cc files, how I update the prompt string member? |
|
#6
|
|||
|
|||
Re: How to access C++ data structureIf you can access those classes, your best course of action (and most direct) is to edit the classes to do what you need. Otherwise you run the risk of confusing not only yourself but others who use your code.
__________________
My personal site: Utilities for text processing, debugging, testing and plotting |
|
#7
|
|||
|
|||
Re: How to access C++ data structureHello L7Sqr,
I can edit the class. I need to add two function calls, a set and get. If the class in the module.h file was written in the following manner ... CPP / C++ / C Code:
With the code written in module.cc like this... CPP / C++ / C Code:
How would I make the call in the main program to set and get the prompt? Last edited by LuciWiz : 20-Jan-2009 at 01:35.
|
|
#8
|
||||
|
||||
Re: How to access C++ data structureSal Bruno, please read the Guidelines from the link in my signature. The way you are trying to use code tags is wrong.
Thank you. __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
Recent GIDBlog
Accepted for Ph.D. program by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Memory leak when nothing is happening... How can I even debug this ? | Algar | MS Visual C++ / MFC Forum | 10 | 19-Nov-2007 08:17 |
| [Include] Doubly-linked List | dsmith | C Programming Language | 6 | 14-Apr-2006 14:12 |
| Strange C++ code memory leakage problem | gaoanyu | C++ Forum | 7 | 04-Nov-2005 09:09 |
| [GIM] Data Module - Contact | dsmith | C Programming Language | 2 | 27-Jan-2005 17:30 |
| [CONTEST?]Data Structure Test | dsmith | C Programming Language | 2 | 06-Jun-2004 16:13 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The