Pointer to struct, containing pointer to an object, for which I want to call a function
- by user1795609
So I've created an ADT which is a singly linked list made up of nodes. These Nodes each have a pointer to an object in them called data.
Class Structure
{
struct Node
{
Object *data;
Node *next;
};
};
Node *head;
I am trying to call a function in the object, like this:
head = new Node;
head -> data = new Object();
head -> next = NULL;
cout << head -> data.print();
I keep getting the following error at compile.
error: request for member 'print' in 'head-Structure::Node::data', which is of non-class type 'Object'*