0
Is . h and . cpp files are same? If not why they have used in this page?
See Destructors
2 odpowiedzi
+ 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.
- 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