I mean in a header file i created a class named Board that contains a 2-dim array named board, in my game i have some creatures moving on this board each has a letter to represent. If i define a header for each creature can i have a common Board object to modify through each of these headers??
This is a sample of function move for the worm from "worm.cpp", were co.x and co.y are the coordinates were the worm exists, here i created a Board object called mybrd,, can i access it through another header file (snake.h for example)
Could you please post the code where mybrd defined, and how the type of mybrd is defined.
Without looking at those, I suggest passing the board as a parameter (preferably as a reference to avoid copying), or setting it as a global variable (not recommended).
Also you should call srand() only once in your program.