Currently having a problem with one of the problem here, I will provide the 2 class(s) here which is required in the specification.
class listNode {
friend class hashTable;
string firstName;
string lastName;
listNode* next;
public:
//listNode() {
// ;here for experiment purpose, not required by specification
//}
listNode(string fn, string ln) {
firstName = fn;
lastName = ln;
next = NULL;
}
void printNode(listNode n) {
cout << '('<< n.firstName << ", " << n.lastName << endl;
}
};
class hashTable{
char op;
int bucketSize;
listNode* hashTable[bucketSize]; //Error occurs
Following is written at the specification for hashTable.
hashTable class
- (char) op // either '+' or '- or '?'
- (int) bucketSize // via argv[2]
- (listNode *) hashTable [bucketSize]
method:
I'm trying to declare array of listNodes with the size of bucket which will be read into from a file However, I can't declare it but it was possible if I do this:
listNode* hashTable[25]; //No error
It will produce error if:
listNode* hashTable[bucketSize]; //Error occurs
or
int bucketSize = 23;
listNode* hashTable[bukcetSize]; //Error
I was thinking about using vector but, specification has to be followed.
This is the error that I get from Visual Studio: (E0245) nonstatic member reference must be relative to a specific object