Reputation: 11
as the title follows I would like to make an inherited class-function from a class-function that throws an exception. The function in the baseclass looks as follow:
template <typename T>
class IQueue {
public:
virtual T dequeue()throw(…) = 0;
}
Note that I'm not allowed to modify this since it's for a class. How am I suppose to declare the function in the diverted class? I have tried like this:
template <typename T>
class Queue : public IQueue < T >{
public:
virtual T dequeue()throw(…) {}
}
But I'm not allowed to run it, and it's giving me error that points to the declaration in the baseclass. So I'm thinking that I'm not overriding it as I should.
These are the errors I'm getting:
unexpected token(s) preceding ';'
syntax error : indentifier '...'
unable to recover from previous error(s); stopping compilation".
and the two at the top are in the IQueue.h and the last one in xlocale. I'm using Visual Studio 2013.
Upvotes: 0
Views: 137
Reputation: 3731
Your problem is due to using the Unicode HORIZONTAL ELLIPSIS character …
instead of ...
. However, even throw(...)
is not compiling on my system. The class is also missing a semicolon at the end of its declaration, although it's not clear if that was a just a mistake when uploading to Stack Overflow.
You mentioned that you copied the class from an assignment description. Whatever this was copied from does not format text correctly, and this should be fixed by the professor/whoever manages the assignments.
Also, in general, using exception specifications is considered a bad idea in C++, anyways.
Upvotes: 3