PP Template

PROGRAMMING POINTERS, LESSON 12

 

 

Syntax/correctness issues

 

12-1      The choice of identifiers that you use in your #ifndef and #define statements is up to you.  Select an identifier similar to the name of the header file.

 

12-2      Remember to place a semicolon (;) after the closing brace of a class.

 

12-3      Remember to place a #endif as the last line in your header file.

 

12-4      Once you have completed the class you cannot compile and run this file as it does not have a function main.  It is called a header file because it will be called near the top of a client program using a #include statement.  The only way to test a header file is with a client program.

            

12-5      You will need to save your dice.h file in an appropriate location on your hard disk.  It is recommended that you place dice.h in the same directory as your apclasses.  See Handout

             H.A.1.3, C++ Compilers, Projects, Adding apclassesfor instructions about storing and accessing header files.

 

 

Formatting suggestions

 

12-6      Indent the public member functions inside the keyword public.  This will make it easier to identify the public vs. private identifiers. Follow the same formatting guidelines with  private state variables.

 

12-7      You are strongly encouraged to use the prefix word "my" in front of the private state variables of a class.  For example, use the identifier mySides instead of sides.  This will help you to keep track of values which belong to a class vs. values which will be passed to an object.