C/C++ : Why do we need to include the .h while everything works when including only the .cpp file?
- by reaffer
Hi ,
Why do we need to include both the .h and .cpp files , while we can make it works with making just a .cpp file and then including it .
Case one :
Creating a file.h containing declarations .
Creating a file.cpp containing definitions .
Including both on the main.cpp .
Case two :
Creating a file.cpp containing declaration/definitions ( no prototypes )
Including it on the main.cpp .
Both worked for me , but still can't the difference since i do not have a background on the compiling and linking process .