I'm making a hash table and my class HashTable consists of the following struct and the following function in my header file:
class HashT
{
public:
struct Node
{
std::string key;
std::string value;
Node* next;
};
Node** HashTArray;
void HashTCopy(struct Node** h1, struct Node** h2, unsigned int sz);
HashT(const HashT& hm); (copy constructor that calls HashTCopy)
unsigned int initialBucketCount = 10;
};
In my source file, I define the function as such and used it in my copy constructor:
void HashT::HashTCopy(struct Node** h1, Node** h2, unsigned int sz)
{
...
}
HashT::HashT(const HashT& hm)
{
new_HashT = new Node* [hm.initialBucketCount];
HashTCopy(new_HashT, hm.HashTArray, hm.initialBucketCount)
}
When I try to compile this I get an error saying out-of-line definition HashT::HashTCopy..."
and.... note: type of 1st parameter of member declaration does not match definition. 'struct Node**' aka 'HashMap::Node** vs 'struct Node** aka HashMap::Node**'
. The compiler points to struct
... 'void HashTCopy(struct Node** h1,....)`. I can't seem to figure out the problem. My declaration and definition match up so what is the issue here? Thanks