Question

I'm getting an error along the lines of 'warning missing braces around initializer for room', while I do understand the meaning of the error, I don't understand why it's being said. Here's the code:

//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 (includes 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}
                    };
}

I don't see any missing braces! Help?

Was it helpful?

Solution

I've just realized that I just pretended a class was an integer. Thanks for everyone's comments though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top