Chapter 15

 < Day Day Up > 



Chapter 14

  1. In your own words describe the goal of operator overloading.

    To tailor the behavior of operators in the context of your programs.

  2. Describe the difference between a shallow copy and a deep copy.

    A deep copy will take into account pointers and the objects they point to whereas a shallow copy will not.

  3. What type of copy does a default, compiler-provided assignment operator perform?

    Shallow

  4. Describe how operator overloading is related to function overloading.

    Operator overloading is function overloading!

  5. (T/F) Operators overloaded in base classes can be overridden in derived classes.

    TRUE

  6. What is the purpose of the dummy integer parameter in the postfix version of the increment and decrement operators?

    The dummy parameter is used by the compiler to distinguish between the two different versions of the operator.

  7. What level of access does a friend function of a class enjoy?

    The same level of access as an ordinary member function.

  8. How would non-member operator functions gain access to private class data members?

    Declare it to be a friend of the class.

  9. When overloading arithmetic operators, to what type of error checking should you pay particular attention?

    That the result of the operation does not exceed the capacity of the return type.

  10. What is the ultimate result and benefit of operator overloading?

    Cleaner, easier to read code.



 < 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