Why are classes normally defined in a header file separate from your main program?
Putting your entire program in one source file would make it very unorganized and would make compile time very long.

Putting a class in a header file is a very simple way to organize so that any source file that needs to use a certain class can just #include its header.

+ Implementation should be hidden(will give option for you to share your libraries); OOP : Encapsulation.

Last edited on
Topic archived. No new replies allowed.