I'm back
Here is my Set class:
Code:
template <class T>
class Set{
private:
T *arr;
int size;
int num;
public:
void insert(T);
bool contains(T);
void print(void);
void sort(void);
Set findIntersect(Set<T>*);
//Set findUnion(Set*);
Set(int);
~Set();
};
I am trying to implement the findIntersect function (and findUnion for that matter) which takes a Set object created by:
Code:
Set<int> *s2 = new Set<int>(5);
In the main file, and compares THIS set to the one in given as an argument.
The problem is, I am getting an error and probably is a small syntax issue (first time working with templates)
Code:
template <class T>
Set Set<T>::findIntersect(Set<T> *s2){
return s2;
}
As you can see ATM the function does nothing, but I am just trying to get it working first.
If I change the return type from Set to void, and just print something, it works, so I am guessing it has to do with that.
Error(s) given by VS2008:
Error 1 error C2955: 'Set' : use of class template requires template argument list
Error 2 error C2244: 'Set<T>::findIntersect' : unable to match function definition to an existing declaration
Thanks