Newb question about tree in c++...
Hi, I have a problem understanding how to increment the occupancy in my constructor is it looks like dis:
Code:
template <class Whatever>
struct TNode {
long balance;
Whatever data;
long height;
TNode<Whatever> * left;
long & occupancy;
TNode<Whatever> * right;
unsigned long & tree_count;
TNode (const Whatever & element, Tree<Whatever> & theTree)
: balance (0), data (element), height (0), left (0),
occupancy (theTree.occupancy), right (0),
tree_count (theTree.tree_count) {
// INCREMENT OCCUPANCY
}
cuz i tried occupancy++; <- doesnt work...
I have tried everythingt o understand... but I still do not understand how to increment the occupancy in the constructor... plz help...