Header files typically include things like class and functions declarations. Then you typically have a CPP file for each header file that implements these functions. So the header may look like this:
class MyClass
{
public:
void Function( );
};
And the CPP file may look like this:
#include "MyClass.h"
void MyClass::Function( )
{
//Do stuff.
return;
}
However typically the header file will have some sort of
include guard. This ensures that the header will never be included more than once, as that could cause multiple declarations of the same class/function.
#pragma once is one of these guards; it ensures that the header will only be included once. So here would be the header with the include guard:
#pragma once
class MyClass
{
public:
void Function( );
};
As for the
voids, ints, bools thing,
void is a return type. It is only really used in functions to show that no value is returned from that function. It can also be used to declare void pointers but that's another topic. Ints and bools are data-types which can be used for variables and returned from functions. If you have a function which adds two numbers together and returns the answer, you may want it to return an int.
int Add( int A, int B )
{
return A + B;
}
That function will take two integer parameters and return their sum. Bools are basically a flag which is either true or false. If you want to make a function that checks if two numbers are the same it would return a bool; true if the two numbers are the same, or false if they aren't.
bool Equivalent( int A, int B )
{
return A == B;
}
And to answer your question, no, data-types and return-types are not used only in header files, they can be used anywhere.
Hopefully that answered your questions, I'm kind of tired so I might have missed some stuff. If you have any questions feel free to ask.