🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Michael Szczepaniak Tue, 15 Sep 1998 00:00
Implementing Generic SLL node structure (wrt 9/10/98 lecture)
#169
Author: Michael Szczepaniak
Date: Tue, 15 Sep 1998 00:00
46 lines
1751 bytes
I'm trying to create my own SLL toolkit using the generic node structure
discussed at the end of the 9/10/98 lecture.  For example, lets call the
header file with the tool/procedures to create and manipulate SLL's
SLL.h (like in the class notes).  In SLL.h we have:

struct SLLnode{
   SLLdata data;
   SLLnode *next;
};

// function prototypes of tool procedures

// function definitions of each tool/procedure

Let's call the file where main() lives work.C (like in the lecture).  In
this file we'll have:

struct SLLdata{
   char name [20];
   int age;
};

#include "SLL.h"
// other include statements like <iostream>, <strings>, etc...

void main()
{

// code for main()

}

My question is:  One of my procedures in SLL.h is SearchNode which finds
the first node that has a name that matches an input target.  How do I
reference the name field?  SLLnode->name generates errors from SLL.h
similar to:

CC: "SLL.h", line 31: error: member name undefined in class SLLnode
(1287)

I can see the usefulness of this abstraction IF I CAN GET TO THE
MEMBERS!  Enlightenment needed.

Thanks,

Michael Sz.
Re: Implementing Generic SLL node structure (wrt 9/10/98 lecture)
#170
Author: gennady gurov
Date: Tue, 15 Sep 1998 00:00
19 lines
1275 bytes
Michael Szczepaniak <mszczepaniak@earthlink.net> wrote:
: I'm trying to create my own SLL toolkit using the generic node structure
: discussed at the end of the 9/10/98 lecture.  For example, lets call the
: header file with the tool/procedures to create and manipulate SLL's
: SLL.h (like in the class notes).  In SLL.h we have:

<snip>
.
.
.

: My question is:  One of my procedures in SLL.h is SearchNode which finds
: the first node that has a name that matches an input target.  How do I
: reference the name field?  SLLnode->name generates errors from SLL.h
                 this        ^^^^^^^^^^^^^ is going to have to be SLLnode->data.name

hope this helps

-Gennady
Re: Implementing Generic SLL node structure (wrt 9/10/98 lecture)
#174
Author: Michael Szczepaniak
Date: Wed, 16 Sep 1998 00:00
25 lines
1489 bytes
Thanks!  That was VERY helpful!

Michael

gennady gurov wrote:

> Michael Szczepaniak <mszczepaniak@earthlink.net> wrote:
> : I'm trying to create my own SLL toolkit using the generic node structure
> : discussed at the end of the 9/10/98 lecture.  For example, lets call the
> : header file with the tool/procedures to create and manipulate SLL's
> : SLL.h (like in the class notes).  In SLL.h we have:
>
> <snip>
> .
> .
> .
>
> : My question is:  One of my procedures in SLL.h is SearchNode which finds
> : the first node that has a name that matches an input target.  How do I
> : reference the name field?  SLLnode->name generates errors from SLL.h
>                  this        ^^^^^^^^^^^^^ is going to have to be SLLnode->data.name
>
> hope this helps
>
> -Gennady
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads