I am confused about the object creation concerning the data members of the BSTNode class. For example, in the header file one of the data members is defined as "Key k". Does this mean that the default key has already been created and I don't need to write anything in the default BSTNode constructor or do I still need to write Key k; in the constructor to create the default key? Does this still hold true when I am passing a Key to set as k in the constructor?
Class definition (in header):
class BSTNode {
public:
BSTNode();
BSTNode(Key k, Value v);
Key k;
Value v;
BSTNode* left;
BSTNode* right;
};
This is my attempt:
template <class Key, class Value>
BSTNode<Key,Value>::BSTNode(){
Key kk; //create th default key
k = kk; //set the BSTNode's k to the default key
Value vv; //create the default value
v = vv; //set the BSTNode's v to the default value
BSTNode* left = NULL; //set left pointer to NULL
BSTNode* right = NULL; //set right pointer to NULL
}