Hi,
I don't have a lot of time atm, so I'll save you the usual verbose intro of how I got myself in my current predicament :P
Basically I have a header file, looks something like this
Code:
#ifndef CLASSES_H
#define CLASSES_H
#include <iostream>
using namespace std;
//******* Part **************
//Abstract class of parts
class Part
{
public:
Part():itsPartNumber(1){}
Part(int num):itsPartNumber(num){}
virtual ~Part(){};
int getPartNumber(){ return itsPartNumber; }
virtual void Display() const = 0; //must be overidden
private:
int itsPartNumber;
};
//some other derived classes, ommited to save space
//********** Part Node *************
class PartNode
{
public:
PartNode(*Part);
~PartNode();
void setNext(PartNode * node){ itsNext = node; }
PartNode * getNext() const;
Part* getPart() const;
private:
Part* itsPart;
PartNode * itsNext;
};
#endif
I have another .cpp file which "includes" this header and simply implements the pure virtual function in the abstract class. I also have a main.cpp file which contains the driver (main) function.
When I try to compile I get the following.
Code:
error C2327: 'PartNode::Part' : is not a type name, static, or enumerator
I get it a couple of times, once for the function which returns a pointer to a Part, and the other time when I declare one of the member variables of the node class to be a pointer to a Part.
They are the only errors I'm getting.
I think I'm making some fundamental error when it comes to having classes as member variables of other classes, but I don't know what it is. Any help would be much appreciated, thanks
Regards,
Stonehambey