-3

I develop a game with help of PopCap Framework. I found this header in demo:

#ifndef __BOARD_H__
#define __BOARD_H__
#include "SexyAppFramework/Widget.h"
namespace Sexy
{
    class Graphics;
    class GameApp;
    class Board : public Widget
    {
        private:
        GameApp*    mApp;
        public:
        Board(GameApp* theApp);
        virtual ~Board();
        virtual void Draw(Graphics* g);
        virtual void Update();
    };
}
#endif // __BOARD_H__

What does the following mean?

namespace Sexy
{
}

I guess it means the same as

using namespace Sexy;

But for the code within braces, is this so?

And what does it mean?

class Graphics;
class GameApp;
Cœur
  • 37,241
  • 25
  • 195
  • 267
Lucky Man
  • 1,488
  • 3
  • 19
  • 41

1 Answers1

4
namespace X {code}  

means that the code in the {} is in namespace X.

using namespace X; 

means that the compiler should look up names you use in namespace X.

http://www.cplusplus.com/doc/tutorial/namespaces/

class Graphics;
class GameApp;

are forward declarations

Irit Katriel
  • 3,534
  • 1
  • 16
  • 18