Page 1 of 1

Referencing members of the MyGame class from a separate CPP?

PostPosted: Sep 25, 2002 @ 3:17pm
by Conan
Can anyone tell me how to access the MyGame class variables etc from a separate .cpp file.

I can declare a prototype for a function within the MyGame class and so long as the function is placed in the same .cpp file outwith the class everything builds fine but when I move the function body into a separate .cpp which includes
using namespace Frog; and
#include <PocketFrog.h>
I get undeclared identifiers etc etc

None of my C++ books nor 2 hours searching web C++ resources tells me how to do this but it's obviously required to write a big program as I can't have everything on one source nor do I want to have to pass values as function parameters all the time.

In C you just have function prototypes and includes & everything works but there's something I'm missing with C++.

PostPosted: Sep 25, 2002 @ 4:13pm
by Guest

PostPosted: Sep 25, 2002 @ 4:17pm
by Mr.Prayer

PostPosted: Sep 25, 2002 @ 5:12pm
by Kzinti

Thanks for the help Mr Prayer & Kzinti

PostPosted: Sep 25, 2002 @ 6:57pm
by Conan

PostPosted: Sep 25, 2002 @ 7:07pm
by Kzinti

Great, that works fine !!!!

PostPosted: Sep 25, 2002 @ 7:49pm
by Conan

Great, that works fine !!!!

PostPosted: Sep 25, 2002 @ 7:58pm
by Mr.Prayer

Sorry Mr Prayer

PostPosted: Sep 25, 2002 @ 8:34pm
by Conan
And they (r y) are not even together on the keyboard, well I have been typing all day and my eyes are sore.

Happy coding