a header file & cpp file

why does visual studio create a header file and a .cpp file when you add a new class?
Do you mean a new project? If so, then you can ask for a empty project and no header or class will be made.
I think TC is talking about using the Add Class menu option. And the reason is classes are usually split into the class definition (in the header) and the implementation (in the source file).
do you guys really know its purpose?
Zhuge has it right. Classes are split into two files, a .h** header for the class definition and a .cpp file for the member function definition. This is so that anyone reading your code doesn't go cross eyed counting open '{' and close '}' brackets.
Topic archived. No new replies allowed.