I want to make a Interface and make the return type of one of the functions a generic(like in java).
I wrote this:
template <class T>
class IUnionFind {
public:
IUnionFind();
///@param[in] x
///@param[in] y
virtual void unionSet(int x,int y)=0;
///@param[in]
virtual void find (int x)=0;
virtual T make_set(int x)=0;
virtual ~IUnionFind(){};
};
And the eclipse compiler does’nt accuse nothing wrong.
However when i make a header to implement the interface like this:
template <class T>
class UnionFindLinkedList : public IUnionFind {
public:
UnionFindLinkedList();
virtual ~UnionFindLinkedList();
void unionSet(int x,int y);
void find (int x);
T make_set(int x);
};
IT accuses “excpected class name before “{” token on the line of the class declaration;
If i remove the generic everything goes fine
It should be