I have a theory question, not a bug report.
I am a new C ++ programmer trying to promote this.
Using the compiler VC ++ VS2008
It often seems to me that I am wondering WHY I want to take some action in the header files.
For example, look at this block of code:
#include "DrawScene.h"
#include "Camera.h"
#include "Player.h"
#include "Grid.h"
#include "InputHandler.h"
#include "GameState.h"
class Controller
{
public:
private:
public:
Controller();
~Controller(){}
void Update();
private:
};
And the attached CPP file, controller.cpp with it
#include "stdafx.h"
#include "glut.h"
#include "Controller.h"
#include <iostream>
Grid* grid_ptr = new Grid();
InputHandler* inputHandler_ptr = new InputHandler();
DrawScene* drawScene_ptr = new DrawScene();
GameState* gameState_ptr = new GameState();
Controller::Controller()
{
}
void Controller::Update()
{
}
What is a good way to decide where to include? So far, I have come with the “everything that works” method, but I consider it somewhat unprofessional.
Now, even if you can say that my code contains X syntax errors and design flaws, do it, but coordinator, I would appreciate that the information is left behind using .h VS.cpp files.
? , - ++ ?
, , , , , .
: # → ++, . .
!
EDIT: 26/08/2010 18:16
, - . ?