In the constructor of the node, you do not construct (new) the
book
or the
procedings
.
In your current design, it should be something like:
node::node()
{
next = NULL;
prev = NULL;
data = NULL;
book = new book;
procedings = new procedings;
}
In the node class, you should have only one member of the base class
publication
; and it the responsability of the caller to allocate the variable.
class node
{
friend class linkedList;
friend class book;
public:
node();
~node();
void setNextNode(node *next);
node* getNextNode(void);
void setPrevNode(node *next);
node* getPrevNode(void);
void setData(int *data);
int* getData(void);
node *next;
node *prev;
int *data;
publication* m_Publication;
};
and in the code, you can have something like :
temp = new node;
publication* currentpublication = new publication;
node->publication = currentpublication;
or
temp = new node;
procedings* currentprocedings = new procedings;
node->publication = currentprocedings;
Max.