Check out example codes for "defining function in other file". It will help you in understanding the concepts better.

Code Example 1

//Your .h file..
#ifndef MY_HEADER
#define MY_HEADER
 int add(int, int);
#endif 

//main.cpp
#include "myHeader.h"

int main()
{
  int result = add(1,2);
  return 0;
}

//file that contain definition of the functions...
//.cpp
#include "myHeader.h"

int add(int a, int b)
{
 return a+b;
}

Learn ReactJs, React Native from akashmittal.com