I have another rudimentary question. I somewhat recall hearing that everything in C++ goes inside a class. Then I hear that classes shouldn’t be used where possible. So my question goes: When do you make classes and when do you not? (an example or two would be cool)
And a random side-question: When is it appropriate to put 2 classes in one header? Or does it matter?
In C++ everything need not go inside a class(as opposed to Java where everything does go inside a class).
You should make a class when you want to represent some real world entity for example a person, a customer, an user, animal, car etc. You require to store some data about the entity and have some functions related to the entity.
For Example: Customer. You create a customer class. Customer has the following data to be stored. {name,age,address,phone}. You need some functions like addCustomer(), sendMessage() etc.
Choice of where to use classes and where not to is a serious design issue. There is no general rule. Before you begin your application, you need to sit down with a paper and pencil and brainstorm the basic classes you will be requiring. You can always add and fine tune your design in the future. While designing your classes the most important thing to be kept in mind is code re-usability. Also try to keep your code as loosely coupled as possible.
As a standard practice, you should have one class per header file.