I'm very new to C++ and I'm trying to reproduce a hash table project from youtube. When I'm creating a new project with a new header filr "hash.h", a main.cpp and a hash.cpp, and when I compile and run the main.cpp I get an error saying that my "hash" was ambigious. My thinking is that my hash collided with the std::hash, that's where the errors are from, but I'm not quite sure how to correct it.. please help! This is done in Code::Blocks :)
main.cpp
#include <iostream>
#include <cstdlib>
#include <string>
#include "hash.h"
using namespace std;
int main(){
int index;
hash hashObj;
index = hashObj.Hash("Amanda");
cout << index << endl;
return 0;
}
hash.h
#include <iostream>
#include <cstdlib>
#include <string>
#ifndef HASH_H_INCLUDED
#define HASH_H_INCLUDED
class hash{
public:
int Hash(std::string key);
};
#endif // HASH_H_INCLUDED
hash.cpp
#include <iostream>
#include <cstdlib>
#include <string>
#include "hash.h"
int hash::Hash(string key){
int hash = 0;
int index;
index = key.length();
return index;
}