I tried to find through the forum and online. Also I have read through the header files section of cprogramming.com but could not find the answer. I hope someone here could shed some light to me.
myheader.h
Code:
void myFunction(int x);
myheader.cpp
Code:
#include "myheader.h"
void myFunction(int x)
{
[do something here]
}
myheader2.h
Code:
#include "myheader.h"
void myFunction2(int x);
myheader2.cpp
Code:
#include "myheader.h"
#include "myheader2.h"
void myFunction2(int x)
{
myFunction(12);
[do something here]
}
main.cpp
Code:
#include "myheader2.h"
myFunction(12);
myFunction2(12);
I have 2 questions, they are in red.
1. Where to include the header file of "myheader.h". Is it in "myheader2.h" or "myheader2.cpp" or both?
2. When I include "myheader2.h" in "main.cpp", will it automatically 'inherit' the "myheader.h"?
Thanks in advance.