Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Why are classes normally defined in a header file separate from your main program? C++

0 votes
asked May 9 by TylerBlachowiak (230 points)

Why are classes normally defined in a header file separate from your main program?

C++

1 Answer

0 votes
answered May 13 by Juergen (300 points)
This is because you might want to reuse the class declaration in other parts (souce files) of your program or in other programs.

Think of a class that defines a point in 3D.

Then you might want to use this class in many programs or inherit from this class
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...