-
Notifications
You must be signed in to change notification settings - Fork 3
/
string3.hpp
30 lines (28 loc) · 933 Bytes
/
string3.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* Die folgenden Code-Beispiele stammen aus dem Buch:
* Objektorientiertes Programmieren in C++
* Ein Tutorial für Ein- und Umsteiger
* von Nicolai Josuttis, Addison-Wesley München, 2001
*
* (C) Copyright Nicolai Josuttis 2001.
* Diese Software darf kopiert, verwendet, modifiziert und verteilt
* werden, sofern diese Copyright-Angabe in allen Kopien vorhanden ist.
* Diese Software wird "so wie sie ist" zur Verfügung gestellt.
* Es gibt keine explizite oder implizite Garantie über ihren Nutzen.
*/
namespace Bsp {
class String {
public:
// Fehlerklasse:
class RangeError {
public:
int index; // fehlerhafter Index
// Konstruktor (initialisiert index)
RangeError (int i) : index(i) {
}
};
//...
// Operator [] für Variablen und Konstanten
char& operator [] (unsigned);
const char operator [] (unsigned) const;
};
}