0

我收到了“警告房间初始化程序周围缺少大括号”的错误,虽然我确实理解错误的含义,但我不明白为什么这么说。这是代码:

//manager.h

class mapManager
{
    public:
    mapManager();

    private:
};

class room //how the map tiles will have attributes.
{
    public:
    //public because room needs to be accessible from map manager
    int dir; //direction of the current tile
};

...

//manager.cpp(包括manager.h)

mapManager::mapManager()
{
    room map[4][8] = {
                        {1, 2, 3, 4, 5, 6, 7, 8},
                        {1, 2, 3, 4, 5, 6, 7, 8},
                        {1, 2, 3, 4, 5, 6, 7, 8},
                        {1, 2, 3, 4, 5, 6, 7, 8}
                    };
}

我没有看到任何丢失的大括号!帮助?

4

1 回答 1

0

我刚刚意识到我只是假装一个类是一个整数。不过还是谢谢大家的意见。

于 2011-10-20T22:40:55.830 回答