Advertisement

Public Variables

Started by March 29, 2002 12:05 PM
4 comments, last by gamechampionx 22 years, 7 months ago
How do you declare public variables in C++? It''s for my text RPG.
Check out Drunken Brawl at http://www.angelfire.com/games6/drunken_brawl!
yes, guy!

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
Advertisement
Not a design issue. Moved to For Beginners forum.

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! | Asking Smart Questions ]
Thanks to Kylotan for the idea!
public variable is declared in a .h or .cpp out of any function. Where you declare your const variables.


const int Max_Unit;

int MyPublicVariable; // <- like that.


Or if you are using struct(); or class();
In that case, you have to declare Pulic and Private variables.
like that :

struct() MyStruct // <- I''m not sure of the correct syntax
{
private:
int MyPrivateVariable;

public:
int MyPublicVariable;
voir MyPublicFunction();
};




Troa Technologies.

(real time ray tracing shadow : DK 3d engine)
I don''t get the structure thing, or where public ends. Help!!!
Check out Drunken Brawl at http://www.angelfire.com/games6/drunken_brawl!
I suggest you pick up a good book on C++.

This topic is closed to new replies.

Advertisement