0

Is . h and . cpp files are same? If not why they have used in this page?

See Destructors

9th Dec 2016, 8:38 AM
Satish Mhetre
Satish Mhetre - avatar
2 Answers
+ 1
Header files do not perform anything. The only declare functions, variables and constructors. .cpp files define these functions. Then the main .cpp file is the file that the compiler actually reads. What it means is that, for example, you can have cout something in the other .cpp files but nothing will happen because you haven't called the function in the main file.
9th Dec 2016, 9:12 AM
Eddy
- 1
.h are header files they are optional u can write them in source code itself .cpp one, but with large programs with many classes it's best practice to write classes and declarations in separate .h file in same folder and to use .h files use include statement, it will behave as if header file is there only
9th Dec 2016, 8:45 AM
Morpheus
Morpheus - avatar