Question
c++ templated and pointer function definition Question:How to define a templated and function that is a pointer to a struct inside the class? template <
c++ templated and pointer function definition
Question:How to define a templated and function that is a pointer to a struct inside the class?
template<typename theKey, typename theValue>
class BST
{
private:
struct node{
theKey key;
theValue value;
node* left;
node* right;
};
node* CreateLeaf(const theKey &x, const theValue &y);
public:
void insert(const theKey & x, const theValue & y);
};
//Now I want to defined the functions (particularly node* CreateLeaf(const theKey &x, const theValue &y); )
template<typename Key, typename Value>
BST< theKey, theValue>::node* BST
//define function
}
//Okay so my problem is that somehow my compiler say "Missing 'typename' prior to dependent type name 'BST
So what is wrong with this? What might be wrong with this?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started