Quick C++ Question

Miscellaneous Forums/General Discussion/Quick C++ Question

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Haven't done any C++ for a while, and to be honest I mainly used standard C functions with all code in one big file. I'm now using classes and multiple files.

I've defined each class in a header file, a class function file for each class, and I have a main.cpp file. I define the class objects in the main.cpp file.

Now the problem is, because I'm not defining the class object until main, one of my classes can't access the class function of another. How do I accomplish this?

Thanks in advance, Steve.

Classes

csBoard
csInput

Objects

obBoard
obInput

Problem lines in csInput

iMovepiece = obBoard.iBoard[iSqr];
obBoard.update(iMovepiece, iMovefrom, iMoveto);

Clearly class object obBoard hasn't been defined yet (just the class definition) so gives a compiler error. It doesn't work with the class name csBoard either.

Main File

csBoard obBoard;
csInput obInput;