CS 105: C++
Quiz 13 Requirements
C++: Chapter 11, 12

  1. Understand the basics of templates in C++ as described in Chapter 11.  Why are class templates useful?
  2. Know how to change a non-template class definition to a class template: What exact syntax do you add before the start of the class definition?  Is any special syntax required to use the parameterized type within the template version of the class and its member functions?

  3. The syntax for defining a member function outside of a class template is ugly.  Learn it!  What exact syntax do you add before the start of the function definition?  What exactly do you add to the normal class scope operator?

  4. Once a class template is in place, know how to declare a variable that uses it.  For example, know the exact syntax to declare an array of integers using the class template Array defined at the start of Chapter 11.

  5. What's wrong with the following declaration:

    Array<Array<int>> iaa;

  6. Understand the basics of polymorphism/virtual functions in C++, as described in Chapter 12.  What does polymorphism allow you to do?  How do virtual functions make this possible?  How are base/derived classes and pointers used as a part of this?

  7. What exact syntax is used to indicate that a member function is virtual?  Is this syntax required in the base class, the derived class, or both?

  8. Does polymorphism work through references as it does through pointers?




Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.