
-----------------------------------
drummaboy
Wed Apr 07, 2010 7:13 pm

Calling a function from another class
-----------------------------------
Hi.
I'm making a little text based battle game and I need to know how to call a function from another class.
I'll give you an example of what I want to do.

(it's not in full detail)

header file
class Player {
void attack ();
... 

.cpp file

void attack () {
cout  instead of . to access the enemy's members), so it would look like this: ReturnType FunctionName(Type &paramName). For example:

#include 

using namespace std;

void Increment(int &someNumber)
{
    someNumber++;
}

int main()
{
    int num = 5;
    cout 