Can someone explain to me how to get this piece of code to compile? What's the syntax error here?
template <typename T>
class Queue
{
public:
class Overflow {};
};
template <typename T, typename QUEUE>
class Queue_Adapter : public Queue<T>
{
public:
void fun();
};
template<typename T, typename QUEUE>
void
Queue_Adapter<T, QUEUE>::fun()
{
throw Queue<T>::Overflow();
}
int main()
{
Queue_Adapter<int, int> tmp;
tmp.fun();
return 0;
}
I get the error message below:
test.cpp:19:19: error: 'Overflow' does not refer to a value
throw Queue<T>::Overflow();
~~~~~~~~~~^
test.cpp:25:7: note: in instantiation of member function 'Queue_Adapter<int,
int>::fun' requested here
tmp.fun();
^
test.cpp:5:11: note: declared here
class Overflow {};
^
1 error generated.
(To get rid of the error message complaining about my question being mostly code...)