0

I am having trouble defining and creating said array, however.

 template <typename DataType, typename KeyType> class HashTable {
    public:
    HashTable(int intTableSize);
    HashTable(const HashTable& other);
    HashTable& operator=(const HashTable& other);

    ~HashTable();

    void insert(const DataType& newDataItem);
    bool remove(const KeyType& deleteKey);
    bool retrieve(const KeyType& searchKey, DataType& returnItem) const;
    void clear();

    bool isEmpty() const;

    void showStructure() const;

    double standardDeviation() const;

    void hashFunction();
    void hashFunction(const DataType& nodeValue);
}

contains private members:

Table <DataType, KeyType> *dataTable;
int tableSize;

The dataTable needs to be of data type array. How do I implement this change? Do I need to make changes to the typenames? When calling dataTable in HashTable.cpp, I get an error stating that " 'dataTable': Identifier not found. Thanks for any help

  • 1
    What kind of array exactly? There are fixed size ones like `int my_array[10]`, or you can allocate space for them with an allocator like `malloc`, or you can use the C++ standard library classes `std::vector` and `std::array`. What have you tried so far and what is the specific problem you encountered? – David Grayson Dec 06 '21 at 03:33
  • 1
    I don't see any private members. I see an empty class template definition missing a semi-colon. – paddy Dec 06 '21 at 05:08
  • What does your HashTable class look like, how does it store its data? Also you might consider template with N becoming the size of your array. – Pepijn Kramer Dec 06 '21 at 05:58
  • Post some more code. Your question is ambiguous. – digito_evo Dec 06 '21 at 06:41
  • The code you have now added is still insufficient. Where are the definitions of your private members? If we can't see how you've tried, we can't tell you what you've done wrong. – Adrian Mole Dec 10 '21 at 14:43

0 Answers0