Making a linked list and ran into an issue. I'll provide a very simplied version of what I'm doing that I *think* will still have enough info to solve my basic issue.
In each node of the LL, there is an object:
Code:
struct Node
{
Node(const Factory& h);
Factory data;
Node * nextNode
};
the constructor for Factory objects looks like this (and it's the only constructor I'm able to use, I cannot create another constructor):
Code:
Factory::Factory(const char * const name, const int size)
{
//code for copying arguments into Factory's data members
}
Here's the constructor for Node:
Code:
LinkedList::Node::Node(const Factory& h) : nextNode(NULL)
{
// ???
}
I want to initialize
data by copying the data member values from
h, but I'm not sure how to do this. In that first bit of code
data does not have an argument list that corresponds with the constructor.
Basically, if line 4 in the top snippet was in the format "
Factory data( argument1, argument2)" I'd know what to do. But with no argument list it seems like it needs to call the default constructor, where no default constructor exists. Hope that makes sense