Object Oriented Programming / C++

Due in class Friday, December 4th.

  1. (Inheritance / Containers) Briefly describe the advantages and disadvantages (tradeoffs) involved in a language that requires all its objects to (eventually) inherent from a common base class (e.g. JAVA where every class has java.lang.object as its root (ultimate base class)).

  2. (Inheritance / Virtual Functions ) Do problem 7.11 in the Sethi textbook (page 297). You should use cout and not printf() for output (you will need to #include <iostream>).

  3. (Exceptions / Templates) Implement a stripped down version of a parameterized Queue class (that throws exceptions). You should support the functionality in the (partial) class declaration given below. [Note: A queue is a FIFO (first in first out) data structure. Objects come off the "front" of the queue in the order they were added to the "back" of the queue.] Write a simple program to demonstrate your Queue class working with several different builtin types and one try/catch block.

Aside: The operator % performs module arithmetic. (e.g. 5 % 6 = 5, 5 % 3 = 2, 5 % 2 = 1). This will help you in implementing the "circular" buffer you will need.

      <template class T>

      Class Queue {

      };