C++运算符重载时的垃圾值

use*_*120 0 c++

我只是得到垃圾值.并且调试器显示正确的值是很奇怪的.但它印刷的怪异东西......

这个第一部分很好.从本质上讲,它只是把我带到我的问题.我有我需要在h.hashtable [hashIndex]数组中打印的内容.

ostream& operator<<(ostream& out, const hashmap& h)
{
        const char *getSymbol = NULL;
        for ( int hashIndex = 0; hashIndex < maxSize; hashIndex++ )
        {   
            getSymbol = h.hashTable[hashIndex].getSymbol();
            if ( getSymbol ) // Find the one I added.
            {
                h.hashTable->display(out);
                    return out << h.hashTable[hashIndex];
            }
        }
        return out;
}
Run Code Online (Sandbox Code Playgroud)

GRB*_*GRB 5

确保将流设置为以十进制打印

out << dec << s.m_sharePrice;
Run Code Online (Sandbox Code Playgroud)

(m_sharePrice是非指针类型,对吧?)