I've been programming in Java and C# for a while and I guess I always thought of objects and classes as being one and the same but the C++ course I'm following has the classes in .h files and the objects .cpp files. Is this typically how a C++ program is structured? Is the class/object relationship different than other OOP's?
You might as well see classes declarations in a
.cpp file, e.g., if the one who wrote this file decided to use some help-classes that weren't supposed to be part of the API presented in the
Also, you might see in a
.h file an object that is being held within a class as its private member.
Indeed, Java "pushes" you towards a pretty strict source and class files organization, that in many cases will match your folders & files organization. C++ allows you much more freedom in this regard, but however has the notion of
includeing header files.