Hey folks,
So I'm running into trouble with this HW code I'm trying to write (making a linked list). It's my idea to pass a pointer to my list object and then have it carry out some processes which I have yet to write. For some reason however, in the list class.cpp, the compiler is giving me an error saying the method is incompatible with the declaration in the header.
Other things: I have a class named node. (list will interact with nodes eventually...)
Also, don't worry about extraneous includes unless that's the issue.
My list class header:
___________________________________________
#pragma once
#include <iostream>
#include "Node Class.h"
using namespace std;
class list
{
public:
int returnNodeValue(void);
void addItem(node*);
list();
private:
node* top;
node* passedAddress;
};
___________________
My list class.cpp:
#include "Node Class.h"
#include "List Class.h"
using namespace std;
void list::addItem(node* newNodeAddress)
{
if (top == NULL)
{
}
}
//constructor
list::list()
{
passedAddress = NULL;
top = NULL;
}
____________________________________
The error is underlined at addItem in "void list::addItem(node* newNodeAddress)"
I really have no idea why this doesn't work. I am able to replace "int" with node, and then it works.
Thanks for any help!
So I'm running into trouble with this HW code I'm trying to write (making a linked list). It's my idea to pass a pointer to my list object and then have it carry out some processes which I have yet to write. For some reason however, in the list class.cpp, the compiler is giving me an error saying the method is incompatible with the declaration in the header.
Other things: I have a class named node. (list will interact with nodes eventually...)
Also, don't worry about extraneous includes unless that's the issue.
My list class header:
___________________________________________
#pragma once
#include <iostream>
#include "Node Class.h"
using namespace std;
class list
{
public:
int returnNodeValue(void);
void addItem(node*);
list();
private:
node* top;
node* passedAddress;
};
___________________
My list class.cpp:
#include "Node Class.h"
#include "List Class.h"
using namespace std;
void list::addItem(node* newNodeAddress)
{
if (top == NULL)
{
}
}
//constructor
list::list()
{
passedAddress = NULL;
top = NULL;
}
____________________________________
The error is underlined at addItem in "void list::addItem(node* newNodeAddress)"
I really have no idea why this doesn't work. I am able to replace "int" with node, and then it works.
Thanks for any help!