Can you do this with a class?

Started by
10 comments, last by ApochPiQ 9 years, 11 months ago
//CPP file 1
Game:Game() // Function Definition
{
//variable = value; //**Function code*/
}

//CPP file 2
//Declarations
Game::Game(); //Function Declaration
{
//variables = value; //**Random Global Code*/
}

Just to clarify:

The first Game::Game() is a function definition, so it associates the code block {} under it as its own functionality.

The second Game::Game(); is a function declaration, that doesn't define it. The variable assignments inside the {} block will probably run at global initialization.

Advertisement

Code blocks at file-level are illegal in C++, so no, that code would not run at all - because it wouldn't compile ;-)

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

This topic is closed to new replies.

Advertisement