Article View: csu.cs.200
Article #169Implementing Generic SLL node structure (wrt 9/10/98 lecture)
From: Michael Szczepaniak
Date: Tue, 15 Sep 1998 00:00
Date: Tue, 15 Sep 1998 00:00
46 lines
1751 bytes
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.
Technical Details
Message-ID:
<35FF2F3D.D4B1A777@earthlink.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 127144,62fe57048fa7125a,start X-Google-Attributes: gid127144,public From: Michael Szczepaniak <mszczepaniak@earthlink.net> Subject: Implementing Generic SLL node structure (wrt 9/10/98 lecture) Date: 1998/09/15 Message-ID: <35FF2F3D.D4B1A777@earthlink.net> X-Deja-AN: 391582435 Content-Transfer-Encoding: 7bit X-Posted-Path-Was: not-for-mail Content-Type: text/plain; charset=us-ascii X-ELN-Date: Tue Sep 15 20:18:58 1998 Organization: Eclectic systems Mime-Version: 1.0 Reply-To: mszczepaniak@earthlink.net Newsgroups: csu.cs.200