The following is a simple example where function f() forwards its work to function g():
//g.h
#pragma once
bool g(int x)
{
if (x%2 == 0)
return true;
else
return false;
}
//f.h
#pragma once
bool f(int x);
//f.cpp
#include<iostream>
#include "f.h"
#include "g.h"
bool f(int x)
{
return g(x);
}
//main.cpp
//Program tested on Microsoft Visual Studio 2008 - Zahid Ghadialy
#include<iostream>
#include "f.h"
using namespace std;
int main()
{
if(f(20))
cout<<"TRUE"<<endl;
else
cout<<"FALSE"<<endl;
return 0;
}
There are couple of things to keep in mind when writing them. See here.
You can read more about seperating Interface and Implementation here.