Correct way to add a const to a class
<p>This does not work.  It gives an error regarding ISO C++ forbidding initialization.</p>

<pre><code>class hash_map 
{
private:
    hash_entry **table;
    const int TABLE_SIZE = 128;
public:
    hash_map() 
    {
        table = new hash_entry*[TABLE_SIZE];
        for (int i = 0; i &lt; TABLE_SIZE; i++)
            table[i] = NULL;
    }
    int get(int key) 
    {
        int hash = (key % TABLE_SIZE);
        while (table[hash] != NULL &amp;&amp; table[hash]-&gt;getKey() != key)
            hash = (hash + 1) % TABLE_SIZE;
        if (table[hash] == NULL)
            return -1;
        else
            return table[hash]-&gt;getValue();
    }
    void put(int key, int value) 
    {
        int hash = (key % TABLE_SIZE);
        while (table[hash] != NULL &amp;&amp; table[hash]-&gt;getKey() != key)
            hash = (hash + 1) % TABLE_SIZE;
        if (table[hash] != NULL)
            delete table[hash];
        table[hash] = new hash_entry(key, value);
    }
    ~hash_map() 
    {
        for (int i = 0; i &lt; TABLE_SIZE; i++)
            if (table[i] != NULL) delete table[i];
        delete[] table;
    }
};
</code></pre>
