www.gibmonks.com

Main Page




Previous Page
Next Page

[Page 519 (continued)]

Self-Review Exercises

9.1

Fill in the blanks in each of the following:

  1. Class members are accessed via the ________ operator in conjunction with the name of an object (or reference to an object) of the class or via the ___________ operator in conjunction with a pointer to an object of the class.

  2. Class members specified as _________ are accessible only to member functions of the class and friends of the class.

  3. Class members specified as _________ are accessible anywhere an object of the class is in scope.

  4. __________ can be used to assign an object of a class to another object of the same class.

9.2

Find the error(s) in each of the following and explain how to correct it (them):

  1. Assume the following prototype is declared in class Time:

    void ~Time( int );
    
  2. The following is a partial definition of class Time:

    class Time
    {
    public:
       // function prototypes
    
    private:
       int hour = 0;
       int minute = 0;
       int second = 0;
    }; // end class Time
    
  3. Assume the following prototype is declared in class Employee:

     int Employee( const char *, const char * );
    


Previous Page
Next Page