Project 3 Notes
printFK(FK, 1);
should instead be
printFK(*FK, 1);
HT_Node ** HashTable;
seems to be causing some confusion. Here's some help.
HashTable should be thought of as a dynamically allocated array of pointers to HT_Node's. When an HT_Node is converted from a leaf to an internal node, it will need an array of pointers to its children HT_Node's. This allocation is done by
HashTable = new HT_Node*[HashTree::HashTableSize];
You can then treat HashTable as an array, filling in the
pointers to its children.
Here is a simple example illustrating some of the features of static member variables.
class Foo {
friend class Grog;
public:
Foo() { Bar=1; x=5; }
private:
static int Bar;
int x;
};
int Foo::Bar = 5;
class Grog {
public:
Grog() {};
void PrintBar() { std::cout << "In Grog: " << Foo::Bar << std::endl; }
};
int
main ()
{
Grog g;
g.PrintBar(); // outputs 5
Foo f;
g.PrintBar(); // outputs 1
}