|(4 intermediate revisions by 2 users not shown)|
| || |
|−|is called when the user moves out of the centigrade input box ( onBlur) : |+|
called the of the ()
| || |
|−|<form name=" Converter" > |+|
"" the ()"
|−|Enter the Centigrade Temperature: |+|
|−|<input type=text name="centigrade" size=10 onblur="convertIt()" > |+|
| || |
|−|Press " tab" to see the Farenheit Temperature: |+|
"" "" "'the "
|−|<input type=text name=" faren" size=10> |+|
|−|<center onClick=" alert(' You will soon go to the next page')" >HELLO!</center> |+|
Latest revision as of 08:40, 23 October 2010
So here we have the "header file" called MyClass.h - which contains the declaration of MyClass - and all of the really simple functions (maybe everything under 5 or so lines long is a good rule of thumb). Every ".cpp" file that implements or uses MyClass has to #include this header file. For the very simplest classes, you may not need a ".cpp" file - in which case you can just leave it out.
Each "MyClass.cpp" file must #include (at a minimum) the MyClass.h file so that it can 'see' the class definition at compile time...but it also has to #include the header files for all of the classes that it references (including system headers for classes such as I/O, math, etc). However, in a complicated program with dozens to hundreds of classes, it can get really hard to remember all of the header files you need - and there is always a half dozen system header files to include (things like 'iostream' that declares std::cout for example). Hence, a common thing is to make a 'main.h' header that includes all of the other headers - so you only have to remember to stick a '#include "main.h"' at the top of every .cpp file - and you're good to go.
Then we have MyClass.cpp which contains the implementation of the function "AReallyReallyComplicatedFunction" - and we have "main.cpp" that contains our main program. Usually, this file is named after the program itself rather than "main" - so if this is MyFirstVideoGame then we'd probably call the files "MyFirstVideoGame.h" and "MyFirstVideoGame.cpp".