Click here to Skip to main content
15,914,160 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VC6 internal compiler error Pin
Mircea Puiu11-Mar-05 5:08
Mircea Puiu11-Mar-05 5:08 
GeneralXP UpdateWindow Problem Pin
gregcodeproject10-Mar-05 3:45
gregcodeproject10-Mar-05 3:45 
Generalproblem with MessageBox Pin
doneirik10-Mar-05 3:14
doneirik10-Mar-05 3:14 
GeneralRe: problem with MessageBox Pin
David Crow10-Mar-05 3:17
David Crow10-Mar-05 3:17 
GeneralRe: problem with MessageBox Pin
doneirik10-Mar-05 3:33
doneirik10-Mar-05 3:33 
GeneralRe: problem with MessageBox Pin
Steen Krogsgaard10-Mar-05 4:16
Steen Krogsgaard10-Mar-05 4:16 
QuestionHow to get a pointers data type? Pin
Gadjuka10-Mar-05 2:44
Gadjuka10-Mar-05 2:44 
AnswerRe: How to get a pointers data type? Pin
Steen Krogsgaard10-Mar-05 3:43
Steen Krogsgaard10-Mar-05 3:43 
I would put everything in one node class:
<br />
struct node<br />
{	<br />
   string label;	<br />
   node *next;<br />
   node *child;<br />
};<br />
<br />
template<typename typeOfData>struct dataNode : public node<br />
{	<br />
   typeOfData *data;<br />
}<br />
<br />
void traverse(node *start)<br />
{<br />
   node* current=start;<br />
   while (current) <br />
   {<br />
       cout << (static_cast<dataNode<int> >)->*data < endl // if you want the data pointet to, not the pointer itself<br />
       if (child) traverse(child);<br />
       current = next;<br />
   }<br />
}<br />

This uses recursion, but it's just an example. I would use child == NULL as an indication that it's a "node" node and child != NULL as proof that it's a "title" node. But you can also implement type information (e.g. by an enum) as a member variable in the struct.

In any event, you still have a problem with identifying what kind of data data points to, here you also need some sort of type information analogous to the node-type problem.

Cheers
Steen.

"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
GeneralRe: How to get a pointers data type? Pin
Gadjuka10-Mar-05 5:13
Gadjuka10-Mar-05 5:13 
AnswerRe: How to get a pointers data type? Pin
PJ Arends10-Mar-05 16:54
professionalPJ Arends10-Mar-05 16:54 
GeneralRe: How to get a pointers data type? Pin
Gadjuka10-Mar-05 22:40
Gadjuka10-Mar-05 22:40 
GeneralRe: How to get a pointers data type? Pin
PJ Arends11-Mar-05 10:21
professionalPJ Arends11-Mar-05 10:21 
QuestionTemporary Internet Files ? Pin
Larsson10-Mar-05 2:42
Larsson10-Mar-05 2:42 
AnswerRe: Temporary Internet Files ? Pin
ThatsAlok10-Mar-05 2:51
ThatsAlok10-Mar-05 2:51 
GeneralRe: Temporary Internet Files ? Pin
Larsson10-Mar-05 2:58
Larsson10-Mar-05 2:58 
GeneralRe: Temporary Internet Files ? Pin
Larsson10-Mar-05 3:20
Larsson10-Mar-05 3:20 
GeneralRe: Temporary Internet Files ? Pin
David Crow10-Mar-05 5:00
David Crow10-Mar-05 5:00 
GeneralRe: Temporary Internet Files ? Pin
ThatsAlok10-Mar-05 19:26
ThatsAlok10-Mar-05 19:26 
GeneralRe: Temporary Internet Files ? Pin
Larsson11-Mar-05 23:04
Larsson11-Mar-05 23:04 
GeneralNMSMTP component C++ builder 6 Pin
PhilWalker10-Mar-05 2:41
PhilWalker10-Mar-05 2:41 
QuestionIs this a Memory Issue? Pin
brdavid10-Mar-05 2:38
brdavid10-Mar-05 2:38 
AnswerRe: Is this a Memory Issue? Pin
Serge Krynine10-Mar-05 12:10
Serge Krynine10-Mar-05 12:10 
GeneralRe: Is this a Memory Issue? Pin
brdavid11-Mar-05 4:04
brdavid11-Mar-05 4:04 
GeneralUSB driver Pin
SJolly10-Mar-05 2:01
SJolly10-Mar-05 2:01 
GeneralRe: USB driver Pin
Alexander M.,10-Mar-05 2:13
Alexander M.,10-Mar-05 2:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.