|
@@ -35,28 +35,26 @@
|
|
|
return 0;
|
|
|
}
|
|
|
</pre>
|
|
|
-<p>Hint: heap allocation and deallocation should occur exactly once!</p>
|
|
|
+ <p>Hint: heap allocation and deallocation should occur exactly once!</p>
|
|
|
|
|
|
<h2>7</h2>
|
|
|
-
|
|
|
- <h2>8</h2>
|
|
|
<p>Why should destructors in an abstract class almost always be declared <code>virtual</code>?</p>
|
|
|
|
|
|
- <h2>9</h2>
|
|
|
+ <h2>8</h2>
|
|
|
<p>Provide an implementation for:</p>
|
|
|
<pre>
|
|
|
Stack(const Stack& s);
|
|
|
Stack& operator=(const Stack& s);</pre>
|
|
|
<p>as declared in the slides for lecture 7.</p>
|
|
|
|
|
|
- <h2>10</h2>
|
|
|
+ <h2>9</h2>
|
|
|
<p>Provide an implementation for:</p>
|
|
|
<pre>
|
|
|
template<class T> T Stack<T>::pop();
|
|
|
template<class T> Stack<T>::~Stack();</pre>
|
|
|
<p>as declared in the slides for lecture 7.</p>
|
|
|
|
|
|
- <h2>11</h2>
|
|
|
+ <h2>10</h2>
|
|
|
<p>A hardware engineer stores a FIFO queue of bits in an <code>int</code> on a platform with<br>
|
|
|
32-bit ints and 8-bit <code>char</code>s using the following C++ class:</p>
|
|
|
<pre><code>class BitQueue {
|