Reply to Message

Prototypes
For a strong statically typed language to know a function or class signature the compiler must read and parse it. Header files allow client code to have access to those definitions without having access to the implementation keeping the application's physical coupling low. This allows the implementation to change without the client code needing to be recompiled (providing the signature has not changed). In small applications this is not a big deal, but in large applications a change could require a lot of code to be recompiled due to header inclusion dependencies.

Keeping headers in sync with the implementations is a piece of cake. If you screw up the compiler tells you immediately and you fix it. In practice this type of error rarely happens.

A great thing about header files is that they allow you to create a declaration from a class that is separate from the implementation. This makes the class structure much more clear than in languages that mix the declaration and implementation together (ex: Java).
Posted by Mike Page
Updated - 18th Jun