Reputation: 99
#ifndef LISTTEST_H
#define LISTTEST_H
#include <vector>
#include <string>
template <class T>
class ListTest {
public:
vector<T>* encrypt(vector<T> *list, int* key);
void setkeyLength(int keyLength);
int getKeyLength();
private:
int keyLength;
};
#endif /* LISTTEST_H */
I have included vector and string header files in my own header file, but in "vector* encrypt(vector list, int key);" the compiler is giving error that vector is undefined what am I am doing wrong here
Upvotes: 1
Views: 123
Reputation: 13025
They are contained in std
namespace:
std::vector<T>* encrypt(std::vector<T> *list, int* key);
Upvotes: 1
Reputation: 61910
You need to qualify the vector
using std::vector
, as it's part of the std
namespace. You should also consider removing <string>
, as you don't use it in the header.
Upvotes: 2