Chapter 12

 < Day Day Up > 



Chapter 11

  1. What is the primary difference between primitive data type objects and class objects?

    Class type objects will play an expanded role in software systems. (They will perhaps interact with other class type objects in the system)

  2. List the four special class member functions and describe the function of each. Which three of the four special functions can be overloaded?

    Constructor (can be overloaded), destructor (cannot be overloaded), copy constructor (can be overloaded), and copy assignment operator (can be overloaded)

  3. List the three access specifiers. Describe how each access specifier affect horizontal access.

    public, protected, and private. Public access allows horizontal member access; protected and private do not.

  4. In your own words define the term horizontal access.

    The ability of a client program the access the interface of member elements of an object.

  5. What is the difference between accessor and mutator functions?

    Accessors return the value of an attribute but do not alter the attribute value leaving the object state unchanged.

    Mutators will change the attribute value which results in an object state change.

  6. What is the purpose of the this pointer?

    The this pointer is a special pointer that contains the address of the current object.

  7. What is the difference between a static class-wide variable and an instance variable?

    A static, class-wide variable is available to all class object, whereas an instance variable is specific to a particular object. (All objects share static, class-wide variables but have their very own copies of instance variables)

  8. Describe how member functions can be overloaded.

    Member functions are overloaded like regular functions.

  9. List and discuss two benefits of separating class interface from class definition. Can you think of any other benefits?

    To hide implementation details.

    To be able to distribute class interface specifications as header files and definitions as libraries.

  10. How would you access an instance variable masked by a local function variable of the same name?

    By using the this pointer.



 < Day Day Up > 



C++ for Artists. The Art, Philosophy, and Science of Object-Oriented Programming
C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504028
EAN: 2147483647
Year: 2003
Pages: 340
Authors: Rick Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net