Systemnahe Programmierung in C: Vererbung |
1#include <stdlib.h>
2#include "Stack4.cc"
3
4class SaveStack : public Stack {
5
6public:
7
8 int top(void) {
9 if ( isEmpty() ) exit(1);
10 return a[topPtr -1];
11 }
12
13 void pop(void) {
14 if ( isEmpty() ) exit(1);
15 --topPtr;
16 }
17
18};
19
20class ExtendedStack : public SaveStack {
21
22public:
23
24 int get() {
25 int v = top();
26 pop();
27 return v;
28 }
29};
|
|
Letzte Änderung: 11.01.2007 | © Prof. Dr. Uwe Schmidt |