// @topic T50920 Miscellaneous small samples developed in class
// @brief 09/20/2012 -- using global and static variables
int track_length = 1500; // global variable
class GateController {
public:
static const int CONTROLLER_ID = 1104;
private:
bool blocked;
public:
// operations:
void block() { blocked = true; }
void unblock() { blocked = false; }
bool get_state();
};//class GateController
int main()
{
int trackLength = 0; // local var overshadows the global
::track_length = 22000; // global scope resolution
int id = GateController::CONTROLLER_ID; // accessing static member
// creating and using objects:
GateController gc;
GateController gc2;
gc.unblock();
gc2.block();
return 0;
}