Chapter 11

 < Day Day Up > 



Chapter 10

  1. (T/F) The typedef keyword lets you create a new data type that better represents your problem domain.

    FALSE. The typedef keyword lets you create a type synonym (create a new name for an existing type) that can then be used to better represent your problem domain.

  2. (T/F) Enumerations are new data types.

    TRUE.

  3. What type of operator would you use to access a structure object's data or function members?

    The dot operator.

  4. What type of operator would you use to access a structure object's data or function members via a pointer?

    The -> operator

  5. Describe how to use the '.' operator in conjunction with the '*' operator to access a structure object's data or functions members via a pointer.

    Dereference the pointer with the * operator and then access the object's elements via the dot operator. For example: (*pointer).memberFunction()

  6. List and discuss the three major differences between structures and classes.

    Structures have default public access - classes have default private access

    Structures use the struct keyword - classes use the class keyword

    Structures represent the C way of thinking - classes represent the C++ way of thinking

  7. Describe the code changes that were necessary to convert the struct version of Person to the class version.

    The keyword struct was changed to class.

  8. Why do you suppose the default access for a class is private?

    To support the notion of data encapsulation.

  9. Define the term data encapsulation.

    The act of declaring class attributes private and access them via public interface functions.

  10. What is meant by the term interface?

    The set of public interface functions used to access class functionality.



 < 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