The purpose of the header file is to give your notes on the class and the function prototypes only.
a function prototype would be like
int my_proto(int, float, char);
Your implementation of these functions are put in to a seperate .ccp file that includes your header. Then you compile without linking the implementation file into an object file.
You give the object file and the header (explanation of functions) to your class user. They do not get to see how you implemented the code because it is in near machine language, so it is kept secret.
The class user looks at your header file and says, "Aha. Though I do not even know how he implemented the code for these functions, I do know what they need to receive and what they return (as well as their name)."
"I know that I can use
the_class.my_proto(int, float, char)
and supply the function with an int, a float, and a char, and I will get back an int. Wonder how he did that? I guess I will never know."
In your header(description) file, you will want PRE:, POST:, and RETURN: description. They tell the class user what the function does without giving away any code.
Code:
// PRE: Accepts age as an int, years of service
// as a float, and category as a char
// POST: Performs necessary calculations on data and
// stores information in private data members
// RETURN: Returns a 0 if successful, a 1 if unsuccessful,
// or a 2 if years of service incorrect
int my_proto(int,float,char);
From that information, you now know how to utilize the function as a class user, but you don't know what calculations and actions occur in the implementation, and since all you have is a .obj file, you will never know. Unless you pay me big money of course.
And that is the beauty of it....