In C++ you have header(.h) and implementation files(.cpp, .c, .cxx) you need to create these files yourself and add them to the project. In the header file you specify how the class looks, so which methods and variables it has, in the cpp file you actually implement the methods, this is split from how Java or C# does it. When you want to use a class thats defined in another file you include the header file , with a #include statement, into the file where you want to use the class name.
Be careful with including headers in other headers because you can create loops and the compiler can't deal with that. there are other ways to deal with that, forward declarations, but this is a more advanced topic.
PS you can use COM in other files as well they dont have to be in the main.cpp file, the main.cpp is usually just the file that defines and implements the main function so the application can start.