I was always confused about header files. They are so strange: you include .h file which doesn't include .cpp but .cpp are somehow compiled too.  Recently I joined a team project, and of course, both .h and .cpp are used.I understand that this is very important, but I can't live with copy-pasting every function declaration in each of multiple classes we have.How do I handle the 2-file convention efficiently?Are there any tools to help with that, or automatically change one file that looks like example below to .h and .cpp? (specifically for MS VC++ 2010)class A{...    Type f(Type a,Type b)    {        //implementation here, not in another file!    }...};Type f(Type a){     //implementation here}...
What to do if I hate C++ header files?
c++;language design;naming
Writing More Refactoring Friendly C++In C++ you don't have to use headers at all.  You can define the whole object in one file just as you would with C# or Java.  C developers will commonly only keep external calls in a header file.  All the internal calls would be defined in the .c file.  By the same token, you can reserve your C++ .h files for the classes/interfaces (pure virtual abstract classes)/etc. that are intended to be shared outside the DLL.  For internal classes/structs/interfaces, etc. you would simply include the .cpp file you need:#include<myclass.cpp>This doesn't seem to be the most popular approach, but it is legal C++.  It would definitely be a possibility for all your internal code.  This allows the internal code and set of classes to change a lot more radically while providing a more stable interface for code outside your library/executable to interact with.Having your whole class inside one file will make it easier to do what you want.  It won't solve the problem of renaming a method and having to search down every place that method is called, but it will make sure you have more intelligable error messages.  Nothing worse than having your header declare a method one way, but you implement it differently.  Other code that calls the header file will compile properly and you'll get a link exception, while the implementation file will be the one that complains that the method wasn't defined.  When you define every method in place (in the actual class declaration), you'll get the same error message no matter what file includes it.You may also want to look at this question: Good refactoring tools for C++How C/C++ Resolves Header/Implementation FilesAt the base C level (and C++ is built on that foundation), the header files declare the promise of a function/struct/variable which is enough to allow a compiler to create the object file.  Similarly C++ header files declare the promise of functions, structs, classes, etc.  It is this definition that the compiler uses to reserve space in the stack, etc.The the .c or .cpp files have the implementation.  As the compiler converts each implementation file to an object file, there are hooks to unimplemented concepts (what was declared in the header).  The linker ties the hooks to the implementations in other object files and creates a larger binary that includes all the code (shared library or executable).VS SpecificAs to working with those in Visual Studio, there are some wizards that help make things a bit easier.  The new class wizard will create your matching pair of header and implementation files.  There is even a class browser feature that will allow you declare new methods.  It will inject the definition in the header and the implementation stub in the .cpp file.  Visual Studio has had those features for more than a decade (as long as I've used them).