Long time coding, but C ++ is very new. I am trying to understand that I need to change my script style C ++ to organize my first full-length project and achieve the goal. Here is my code of work
My first question is how to create a header file. I am particularly interested in the correct way to handle enumerations. Next, general feedback, cleanup, deletion etc. are possible. I appreciate it very much.
Normally, the header file contains only declarations. They did not define a way to implement something. So, where cout is declared only in the "iostream" header file, where is it actually defined? It is implemented in the C ++ runtime support library which is automatically linked to the program in the link phase. Consider what happens if the iostream header does not exist. Regardless of whether std :: cout is used or not, you must manually copy all stad: cout related declarations to the beginning of each file that uses it. This needs to know what is relevant and what is not related. Including #ostream is much easier.
This program displays "Hello, world!" With cout on the console. However, since this program does not define cout, how does the compiler recognize what cout is? The answer is that cout is declared in the header file "iostream". When using #include lines, you need to copy everything named "iostream" in the header file to the include file. This makes the contents of the header file available in the code file. Normally, the header file contains only declarations. They did not define a way to implement something. So, where cout is declared only in the "iostream" header file, where is it actually defined? It is implemented in the C ++ runtime support library which automatically links to the program in the link phase.