Skip to content

Instantly share code, notes, and snippets.

@andrewberls
Created November 1, 2012 21:55
Show Gist options
  • Save andrewberls/3996896 to your computer and use it in GitHub Desktop.
Save andrewberls/3996896 to your computer and use it in GitHub Desktop.
// hashtable.hpp
class HashTable {
public:
struct HashTable::HashEntry* insert(int);
struct HashEntry {
// Some stuff
};
};
// hashtable.cpp
struct HashTable::HashEntry* HashTable::insert(int item) {
// Do stuff
return &elements[0];
}
// Compile Error:
// In file included from hashtable.cpp:2:
// hashtable.hpp:10: error: ‘HashEntry’ in class ‘HashTable’ does not name a type
// hashtable.cpp:19: error: prototype for ‘HashTable::HashEntry* HashTable::insert(int)’ does not match any in class ‘HashTable’
// hashtable.hpp:10: error: candidate is: int* HashTable::insert(int)
// hashtable.cpp:19: error: ‘HashTable::HashEntry* HashTable::insert(int)’ cannot be overloaded
// hashtable.hpp:10: error: with ‘int* HashTable::insert(int)’
// make: *** [hashtable.o] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment