Sorry for the newbie question, but what are header files? What should they contain? Just classes and definitions?

Recommended Answers

"Header files commonly contain forward declarations of classes, subroutines, variables, and other identifiers." -

Hope this helps :)

Jump to Post

All 3 Replies

If possible, header should contain a skeleton for the desired Object.
For example a header might contain a class skeleton named Car, and you might define
the actual implementation of Car in a different .cpp file. Another example, you
might declare some functions in a header, but do the actual implementation in a different .cpp file.

// this header defines the skeleton for the BestClassInUniverse
class BestClassInUniverse{
  void doTheBestThingInUniverse(); //skeleton
//actually defines the implementations
  //some  top secret code.

Thanks. I understand it now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.